home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / cvs-1.8 / cvs-1 / cvs-1.8.1 / src / sanity.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1996-05-06  |  82.6 KB  |  2,870 lines

  1. #! /bin/sh
  2. :
  3. #    sanity.sh -- a growing testsuite for cvs.
  4. #
  5. # Copyright (C) 1992, 1993 Cygnus Support
  6. #
  7. # Original Author: K. Richard Pixley
  8.  
  9. # usage: sanity.sh [-r] @var{cvs-to-test} @var{tests-to-run}
  10. # -r means to test remote instead of local cvs.
  11. # @var{tests-to-run} are the names of the tests to run; if omitted run all
  12. # tests.
  13.  
  14. # See TODO list at end of file.
  15.  
  16. # required to make this script work properly.
  17. unset CVSREAD
  18.  
  19. TESTDIR=/tmp/cvs-sanity
  20.  
  21. # "debugger"
  22. #set -x
  23.  
  24. echo 'This test should produce no other output than this line, and a final "OK".'
  25.  
  26. if test x"$1" = x"-r"; then
  27.     shift
  28.     remote=yes
  29. else
  30.     remote=no
  31. fi
  32.  
  33. # The --keep option will eventually cause all the tests to leave around the
  34. # contents of the /tmp directory; right now only some implement it.  Not
  35. # useful if you are running more than one test.
  36. # FIXME: need some real option parsing so this doesn't depend on the order
  37. # in which they are specified.
  38. if test x"$1" = x"--keep"; then
  39.   shift
  40.   keep=yes
  41. else
  42.   keep=no
  43. fi
  44.  
  45. # Use full path for CVS executable, so that CVS_SERVER gets set properly
  46. # for remote.
  47. case $1 in
  48. /*)
  49.     testcvs=$1
  50.     ;;
  51. *)
  52.     testcvs=`pwd`/$1
  53.     ;;
  54. esac
  55.  
  56. shift
  57.  
  58. # Regexp to match what CVS will call itself in output that it prints.
  59. # FIXME: we don't properly quote this--if the name contains . we'll
  60. # just spuriously match a few things; if the name contains other regexp
  61. # special characters we are probably in big trouble.
  62. PROG=`basename ${testcvs}`
  63.  
  64. # FIXME: try things (what things? checkins?) without -m.
  65. #
  66. # Some of these tests are written to expect -Q.  But testing with
  67. # -Q is kind of bogus, it is not the way users actually use CVS (usually).
  68. # So new tests probably should invoke ${testcvs} directly, rather than ${CVS}.
  69. # and then they've obviously got to do something with the output....
  70. #
  71. CVS="${testcvs} -Q"
  72.  
  73. LOGFILE=`pwd`/check.log
  74.  
  75. # Save the previous log in case the person running the tests decides
  76. # they want to look at it.  The extension ".plog" is chosen for consistency
  77. # with dejagnu.
  78. if test -f check.log; then
  79.     mv check.log check.plog
  80. fi
  81.  
  82. # That we should have to do this is total bogosity, but GNU expr
  83. # version 1.9.4 uses the emacs definition of "$" instead of the unix
  84. # (e.g. SunOS 4.1.3 expr) one.  Rumor has it this will be fixed in the
  85. # next release of GNU expr after 1.12 (but we still have to cater to the old
  86. # ones for some time because they are in many linux distributions).
  87. ENDANCHOR="$"
  88. if expr 'abc
  89. def' : 'abc$' >/dev/null; then
  90.   ENDANCHOR='\'\'
  91. fi
  92.  
  93. # Work around another GNU expr (version 1.10) bug/incompatibility.
  94. # "." doesn't appear to match a newline (it does with SunOS 4.1.3 expr).
  95. # Note that the workaround is not a complete equivalent of .* because
  96. # the first parenthesized expression in the regexp must match something
  97. # in order for expr to return a successful exit status.
  98. # Rumor has it this will be fixed in the
  99. # next release of GNU expr after 1.12 (but we still have to cater to the old
  100. # ones for some time because they are in many linux distributions).
  101. DOTSTAR='.*'
  102. if expr 'abc
  103. def' : "a${DOTSTAR}f" >/dev/null; then
  104.   : good, it works
  105. else
  106.   DOTSTAR='\(.\|
  107. \)*'
  108. fi
  109.  
  110. # Work around yet another GNU expr (version 1.10) bug/incompatibility.
  111. # "+" is a special character, yet for unix expr (e.g. SunOS 4.1.3)
  112. # it is not.  I doubt that POSIX allows us to use \+ and assume it means
  113. # (non-special) +, so here is another workaround
  114. # Rumor has it this will be fixed in the
  115. # next release of GNU expr after 1.12 (but we still have to cater to the old
  116. # ones for some time because they are in many linux distributions).
  117. PLUS='+'
  118. if expr 'a +b' : "a ${PLUS}b" >/dev/null; then
  119.   : good, it works
  120. else
  121.   PLUS='\+'
  122. fi
  123.  
  124. # Likewise, for ?
  125. QUESTION='?'
  126. if expr 'a?b' : "a${QUESTION}b" >/dev/null; then
  127.   : good, it works
  128. else
  129.   QUESTION='\?'
  130. fi
  131.  
  132. # Cause NextStep 3.3 users to lose in a more graceful fashion.
  133. if expr 'abc
  134. def' : 'abc
  135. def' >/dev/null; then
  136.   : good, it works
  137. else
  138.   echo 'Running these tests requires an "expr" program that can handle'
  139.   echo 'multi-line patterns.  Make sure that such an expr (GNU, or many but'
  140.   echo 'not all vendor-supplied versions) is in your path.'
  141.   exit 1
  142. fi
  143.  
  144. # Warn SunOS, SysVr3.2, etc., users that they may be partially losing
  145. if expr 'a
  146. b' : 'a
  147. c' >/dev/null; then
  148.   echo 'Warning: you are using a version of expr which does not correctly'
  149.   echo 'match multi-line patterns.  Some tests may spuriously pass.'
  150.   echo 'You may wish to make sure GNU expr is in your path.'
  151. else
  152.   : good, it works
  153. fi
  154.  
  155. pass ()
  156. {
  157.   echo "PASS: $1" >>${LOGFILE}
  158. }
  159.  
  160. fail ()
  161. {
  162.   echo "FAIL: $1" | tee -a ${LOGFILE}
  163.   # This way the tester can go and see what remnants were left
  164.   exit 1
  165. }
  166.  
  167. # See dotest and dotest_fail for explanation (this is the parts
  168. # of the implementation common to the two).
  169. dotest_internal ()
  170. {
  171.   # expr can't distinguish between "zero characters matched" and "no match",
  172.   # so special-case it.
  173.   if test -z "$3"; then
  174.     if test -s ${TESTDIR}/dotest.tmp; then
  175.       echo "** expected: " >>${LOGFILE}
  176.       echo "$3" >>${LOGFILE}
  177.       echo "** got: " >>${LOGFILE}
  178.       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  179.       fail "$1"
  180.     else
  181.       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  182.       pass "$1"
  183.     fi
  184.   else
  185.     if expr "`cat ${TESTDIR}/dotest.tmp`" : \
  186.     "$3"${ENDANCHOR} >/dev/null; then
  187.       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  188.       pass "$1"
  189.     else
  190.       if test x"$4" != x; then
  191.     if expr "`cat ${TESTDIR}/dotest.tmp`" : \
  192.         "$4"${ENDANCHOR} >/dev/null; then
  193.       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  194.       pass "$1"
  195.     else
  196.       echo "** expected: " >>${LOGFILE}
  197.       echo "$3" >>${LOGFILE}
  198.       echo "** or: " >>${LOGFILE}
  199.       echo "$4" >>${LOGFILE}
  200.       echo "** got: " >>${LOGFILE}
  201.       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  202.       fail "$1"
  203.     fi
  204.       else
  205.     echo "** expected: " >>${LOGFILE}
  206.     echo "$3" >>${LOGFILE}
  207.     echo "** got: " >>${LOGFILE}
  208.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  209.     fail "$1"
  210.       fi
  211.     fi
  212.   fi
  213. }
  214.  
  215. # Usage:
  216. #  dotest TESTNAME COMMAND OUTPUT [OUTPUT2]
  217. # TESTNAME is the name used in the log to identify the test.
  218. # COMMAND is the command to run; for the test to pass, it exits with 
  219. # exitstatus zero.
  220. # OUTPUT is a regexp which is compared against the output (stdout and
  221. # stderr combined) from the test.  It is anchored to the start and end
  222. # of the output, so should start or end with ".*" if that is what is desired.
  223. # Trailing newlines are stripped from the command's actual output before
  224. # matching against OUTPUT.
  225. # If OUTPUT2 is specified and the output matches it, then it is also
  226. # a pass (partial workaround for the fact that some versions of expr
  227. # lack \|).
  228. dotest ()
  229. {
  230.   if $2 >${TESTDIR}/dotest.tmp 2>&1; then
  231.     : so far so good
  232.   else
  233.     status=$?
  234.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  235.     echo "exit status was $status" >>${LOGFILE}
  236.     fail "$1"
  237.   fi
  238.   dotest_internal "$@"
  239. }
  240.  
  241. # Like dotest except exitstatus should be nonzero.
  242. dotest_fail ()
  243. {
  244.   if $2 >${TESTDIR}/dotest.tmp 2>&1; then
  245.     status=$?
  246.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  247.     echo "exit status was $status" >>${LOGFILE}
  248.     fail "$1"
  249.   else
  250.     : so far so good
  251.   fi
  252.   dotest_internal "$@"
  253. }
  254.  
  255. # Like dotest except second argument is the required exitstatus.
  256. dotest_status ()
  257. {
  258.   $3 >${TESTDIR}/dotest.tmp 2>&1
  259.   status=$?
  260.   if test "$status" = "$2"; then
  261.     : so far so good
  262.   else
  263.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  264.     echo "exit status was $status; expected $2" >>${LOGFILE}
  265.     fail "$1"
  266.   fi
  267.   dotest_internal "$1" "$3" "$4" "$5"
  268. }
  269.  
  270. # clean any old remnants
  271. rm -rf ${TESTDIR}
  272. mkdir ${TESTDIR}
  273. cd ${TESTDIR}
  274.  
  275. # Avoid picking up any stray .cvsrc, etc., from the user running the tests
  276. mkdir home
  277. HOME=${TESTDIR}/home; export HOME
  278.  
  279. # Remaining arguments are the names of tests to run.
  280. #
  281. # The testsuite is broken up into (hopefully manageably-sized)
  282. # independently runnable tests, so that one can quickly get a result
  283. # from a cvs or testsuite change, and to facilitate understanding the
  284. # tests.
  285.  
  286. if test x"$*" = x; then
  287.     tests="basica basic1 deep basic2 death branches import new conflicts modules mflag errmsg1 devcom ignore binfiles info"
  288. else
  289.     tests="$*"
  290. fi
  291.  
  292. # this should die
  293. if ${CVS} -d `pwd`/cvsroot co cvs-sanity 2>> ${LOGFILE} ; then
  294.     echo "FAIL: test 1" | tee -a ${LOGFILE}
  295.     exit 1
  296. else
  297.     echo "PASS: test 1" >>${LOGFILE}
  298. fi
  299.  
  300. # this should still die
  301. mkdir cvsroot
  302. if ${CVS} -d `pwd`/cvsroot co cvs-sanity 2>> ${LOGFILE} ; then
  303.     echo "FAIL: test 2" | tee -a ${LOGFILE}
  304.     exit 1
  305. else
  306.     echo "PASS: test 2" >>${LOGFILE}
  307. fi
  308.  
  309. # this should still die
  310. mkdir cvsroot/CVSROOT
  311. if ${CVS} -d `pwd`/cvsroot co cvs-sanity 2>> ${LOGFILE} ; then
  312.     echo "FAIL: test 3" | tee -a ${LOGFILE}
  313.     exit 1
  314. else
  315.     echo "PASS: test 3" >>${LOGFILE}
  316. fi
  317.  
  318. # This one should work, although it should spit a warning.
  319. mkdir tmp ; cd tmp
  320. ${CVS} -d `pwd`/../cvsroot co CVSROOT 2>> ${LOGFILE}
  321. cd .. ; rm -rf tmp
  322.  
  323. # set up a minimal modules file...
  324. # (now that mkmodules is gone, this doesn't test -i the way it
  325. # used to.  In fact, it looks like a noop to me).
  326. echo "CVSROOT        CVSROOT" > cvsroot/CVSROOT/modules
  327. # The following line stolen from cvsinit.sh.  FIXME: create our
  328. # repository via cvsinit.sh; that way we test it too.
  329. (cd cvsroot/CVSROOT; ci -q -u -t/dev/null \
  330.   -m'initial checkin of modules' modules)
  331.  
  332. # This one should succeed.  No warnings.
  333. mkdir tmp ; cd tmp
  334. if ${CVS} -d `pwd`/../cvsroot co CVSROOT ; then
  335.     echo "PASS: test 4" >>${LOGFILE}
  336. else
  337.     echo "FAIL: test 4" | tee -a ${LOGFILE}
  338.     exit 1
  339. fi
  340.  
  341. if echo "yes" | ${CVS} -d `pwd`/../cvsroot release -d CVSROOT ; then
  342.     echo "PASS: test 4.5" >>${LOGFILE}
  343. else
  344.     echo "FAIL: test 4.5" | tee -a ${LOGFILE}
  345.     exit 1
  346. fi
  347. # this had better be empty
  348. cd ..; rmdir tmp
  349. dotest_fail 4.75 "test -d tmp" ''
  350.  
  351. # a simple function to compare directory contents
  352. #
  353. # BTW, I don't care any more -- if you don't have a /bin/sh that handles
  354. # shell functions, well get one.
  355. #
  356. # Returns: ISDIFF := true|false
  357. #
  358. directory_cmp ()
  359. {
  360.     OLDPWD=`pwd`
  361.     DIR_1=$1
  362.     DIR_2=$2
  363.     ISDIFF=false
  364.  
  365.     cd $DIR_1
  366.     find . -print | fgrep -v /CVS | sort > /tmp/dc$$d1
  367.  
  368.     # go back where we were to avoid symlink hell...
  369.     cd $OLDPWD
  370.     cd $DIR_2
  371.     find . -print | fgrep -v /CVS | sort > /tmp/dc$$d2
  372.  
  373.     if diff /tmp/dc$$d1 /tmp/dc$$d2 >/dev/null 2>&1
  374.     then
  375.         :
  376.     else
  377.         ISDIFF=true
  378.         return
  379.     fi
  380.     cd $OLDPWD
  381.     while read a
  382.     do
  383.         if [ -f $DIR_1/"$a" ] ; then
  384.             cmp -s $DIR_1/"$a" $DIR_2/"$a"
  385.             if [ $? -ne 0 ] ; then
  386.                 ISDIFF=true
  387.             fi
  388.         fi
  389.     done < /tmp/dc$$d1
  390. ### FIXME:
  391. ###    rm -f /tmp/dc$$*
  392. }
  393.  
  394. # so much for the setup.  Let's try something harder.
  395.  
  396. # Try setting CVSROOT so we don't have to worry about it anymore.  (now that
  397. # we've tested -d cvsroot.)
  398. CVSROOT_DIRNAME=${TESTDIR}/cvsroot
  399. CVSROOT=${CVSROOT_DIRNAME} ; export CVSROOT
  400. if test "x$remote" = xyes; then
  401.     CVSROOT=`hostname`:${CVSROOT_DIRNAME} ; export CVSROOT
  402.     # Use rsh so we can test it without having to muck with inetd or anything 
  403.     # like that.  Also needed to get CVS_SERVER to work.
  404.     CVS_CLIENT_PORT=-1; export CVS_CLIENT_PORT
  405.     CVS_SERVER=${testcvs}; export CVS_SERVER
  406. fi
  407.  
  408. # start keeping history
  409. touch ${CVSROOT_DIRNAME}/CVSROOT/history
  410.  
  411. ### The big loop
  412. for what in $tests; do
  413.     case $what in
  414.     basica)
  415.       # Similar in spirit to some of the basic1, and basic2
  416.       # tests, but hopefully a lot faster.  Also tests operating on
  417.       # files two directories down *without* operating on the parent dirs.
  418.  
  419.       # Using mkdir in the repository is used throughout these
  420.       # tests to create a top-level directory.  I think instead it
  421.       # should be:
  422.       #   cvs co -l .
  423.       #   mkdir first-dir
  424.       #   cvs add first-dir
  425.       # but currently that works only for local CVS, not remote.
  426.       mkdir ${CVSROOT_DIRNAME}/first-dir
  427.       dotest basica-1 "${testcvs} -q co first-dir" ''
  428.       cd first-dir
  429.  
  430.       # Test a few operations, to ensure they gracefully do
  431.       # nothing in an empty directory.
  432.       dotest basica-1a0 "${testcvs} -q update" ''
  433.       dotest basica-1a1 "${testcvs} -q diff -c" ''
  434.       dotest basica-1a2 "${testcvs} -q status" ''
  435.  
  436.       mkdir sdir
  437.       dotest basica-2 "${testcvs} add sdir" \
  438. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/sdir added to the repository'
  439.       cd sdir
  440.       mkdir ssdir
  441.       dotest basica-3 "${testcvs} add ssdir" \
  442. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir added to the repository'
  443.       cd ssdir
  444.       echo ssfile >ssfile
  445.  
  446.       # Trying to commit it without a "cvs add" should be an error.
  447.       # The "use `cvs add' to create an entry" message is the one
  448.       # that I consider to be more correct, but local cvs prints the
  449.       # "nothing known" message and noone has gotten around to fixing it.
  450.       dotest_fail basica-notadded "${testcvs} -q ci ssfile" \
  451. "${PROG} [a-z]*: use "'`cvs add'\'' to create an entry for ssfile
  452. '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \
  453. "${PROG}"' [a-z]*: nothing known about `ssfile'\''
  454. '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
  455.  
  456.       dotest basica-4 "${testcvs} add ssfile" \
  457. "${PROG}"' [a-z]*: scheduling file `ssfile'\'' for addition
  458. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  459.       dotest_fail basica-4a "${testcvs} tag tag0 ssfile" \
  460. "${PROG} [a-z]*: nothing known about ssfile
  461. ${PROG} "'\[[a-z]* aborted\]: correct the above errors first!'
  462.       cd ../..
  463.       dotest basica-5 "${testcvs} -q ci -m add-it" \
  464. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v
  465. done
  466. Checking in sdir/ssdir/ssfile;
  467. /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
  468. initial revision: 1.1
  469. done'
  470.       dotest_fail basica-5a \
  471.         "${testcvs} -q tag BASE sdir/ssdir/ssfile" \
  472. "${PROG} [a-z]*: Attempt to add reserved tag name BASE
  473. ${PROG} \[[a-z]* aborted\]: failed to set tag BASE to revision 1.1 in /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v"
  474.       dotest basica-5b "${testcvs} -q tag NOT_RESERVED" \
  475. 'T sdir/ssdir/ssfile'
  476.  
  477.       dotest basica-6 "${testcvs} -q update" ''
  478.       echo "ssfile line 2" >>sdir/ssdir/ssfile
  479.       dotest_status basica-6.2 1 "${testcvs} -q diff -c" \
  480. 'Index: sdir/ssdir/ssfile
  481. ===================================================================
  482. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v
  483. retrieving revision 1\.1
  484. diff -c -r1\.1 ssfile
  485. \*\*\* ssfile    [0-9/]* [0-9:]*    1\.1
  486. --- ssfile    [0-9/]* [0-9:]*
  487. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  488. \*\*\* 1 \*\*\*\*
  489. --- 1,2 ----
  490.   ssfile
  491. '"${PLUS} ssfile line 2"
  492.       dotest basica-7 "${testcvs} -q ci -m modify-it" \
  493. 'Checking in sdir/ssdir/ssfile;
  494. /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
  495. new revision: 1.2; previous revision: 1.1
  496. done'
  497.       dotest_fail basica-nonexist "${testcvs} -q ci nonexist" \
  498. "${PROG}"' [a-z]*: nothing known about `nonexist'\''
  499. '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
  500.       dotest basica-8 "${testcvs} -q update" ''
  501.       dotest_fail basica-9 \
  502.         "${testcvs} -q -d /tmp/cvs-sanity/nonexist update" \
  503. "${PROG}: .*/tmp/cvs-sanity/cvsroot value for CVS Root found in CVS/Root
  504. ${PROG}"': does not match command line -d /tmp/cvs-sanity/nonexist setting
  505. '"${PROG}"': you may wish to try the cvs command again without the -d option '
  506.  
  507.       dotest basica-10 "${testcvs} annotate" \
  508. 'Annotations for sdir/ssdir/ssfile
  509. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  510. 1.1          .[a-z@][a-z@ ]* [0-9a-zA-Z-]*.: ssfile
  511. 1.2          .[a-z@][a-z@ ]* [0-9a-zA-Z-]*.: ssfile line 2'
  512.       cd ..
  513.  
  514.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  515.       rm -r first-dir
  516.       ;;
  517.  
  518.     basic1) # first dive - add a files, first singly, then in a group.
  519.         mkdir ${CVSROOT_DIRNAME}/first-dir
  520.         # check out an empty directory
  521.         if ${CVS} co first-dir  ; then
  522.           echo "PASS: test 13a" >>${LOGFILE}
  523.         else
  524.           echo "FAIL: test 13a" | tee -a ${LOGFILE}; exit 1
  525.         fi
  526.  
  527.         cd first-dir
  528.         files=first-file
  529.         for i in a b ; do
  530.             for j in ${files} ; do
  531.                 echo $j > $j
  532.             done
  533.  
  534.             for do in add rm ; do
  535.                 for j in ${do} "commit -m test" ; do
  536.                     # ${do}
  537.                     if ${CVS} $j ${files}  >> ${LOGFILE} 2>&1; then
  538.                       echo "PASS: test 14-${do}-$j" >>${LOGFILE}
  539.                     else
  540.                       echo "FAIL: test 14-${do}-$j" | tee -a ${LOGFILE}; exit 1
  541.                     fi
  542.  
  543.                     # update it.
  544.                     if [ "${do}" = "rm" -a "$j" != "commit -m test" ] || ${CVS} update ${files} ; then
  545.                       echo "PASS: test 15-${do}-$j" >>${LOGFILE}
  546.                     else
  547.                       echo "FAIL: test 15-${do}-$j" | tee -a ${LOGFILE}; exit 1
  548.                     fi
  549.  
  550.                     # update all.
  551.                     if ${CVS} update  ; then
  552.                       echo "PASS: test 16-${do}-$j" >>${LOGFILE}
  553.                     else
  554.                       echo "FAIL: test 16-${do}-$j" | tee -a ${LOGFILE}; exit 1
  555.                     fi
  556.  
  557.                     # status all.
  558.                     if ${CVS} status  >> ${LOGFILE}; then
  559.                       echo "PASS: test 17-${do}-$j" >>${LOGFILE}
  560.                     else
  561.                       echo "FAIL: test 17-${do}-$j" | tee -a ${LOGFILE}; exit 1
  562.                     fi
  563.  
  564.         # FIXME: this one doesn't work yet for added files.
  565.                     # log all.
  566.                     if ${CVS} log  >> ${LOGFILE}; then
  567.                       echo "PASS: test 18-${do}-$j" >>${LOGFILE}
  568.                     else
  569.                       echo "FAIL: test 18-${do}-$j" | tee -a ${LOGFILE}
  570.                     fi
  571.  
  572.                     cd ..
  573.                     # update all.
  574.                     if ${CVS} update  ; then
  575.                       echo "PASS: test 21-${do}-$j" >>${LOGFILE}
  576.                     else
  577.                       echo "FAIL: test 21-${do}-$j" | tee -a ${LOGFILE}; exit 1
  578.                     fi
  579.  
  580.                     # log all.
  581.         # FIXME: doesn't work right for added files.
  582.                     if ${CVS} log first-dir  >> ${LOGFILE}; then
  583.                       echo "PASS: test 22-${do}-$j" >>${LOGFILE}
  584.                     else
  585.                       echo "FAIL: test 22-${do}-$j" | tee -a ${LOGFILE}
  586.                     fi
  587.  
  588.                     # status all.
  589.                     if ${CVS} status first-dir  >> ${LOGFILE}; then
  590.                       echo "PASS: test 23-${do}-$j" >>${LOGFILE}
  591.                     else
  592.                       echo "FAIL: test 23-${do}-$j" | tee -a ${LOGFILE}; exit 1
  593.                     fi
  594.  
  595.                     # update all.
  596.                     if ${CVS} update first-dir  ; then
  597.                       echo "PASS: test 24-${do}-$j" >>${LOGFILE}
  598.                     else
  599.                       echo "FAIL: test 24-${do}-$j" | tee -a ${LOGFILE} ; exit 1
  600.                     fi
  601.  
  602.                     # update all.
  603.                     if ${CVS} co first-dir  ; then
  604.                       echo "PASS: test 27-${do}-$j" >>${LOGFILE}
  605.                     else
  606.                       echo "FAIL: test 27-${do}-$j" | tee -a ${LOGFILE} ; exit 1
  607.                     fi
  608.  
  609.                     cd first-dir
  610.                 done # j
  611.                 rm -f ${files}
  612.             done # do
  613.  
  614.             files="file2 file3 file4 file5"
  615.         done
  616.         if ${CVS} tag first-dive  ; then
  617.           echo "PASS: test 28" >>${LOGFILE}
  618.         else
  619.           echo "FAIL: test 28" | tee -a ${LOGFILE} ; exit 1
  620.         fi
  621.         cd ..
  622.         rm -rf ${CVSROOT_DIRNAME}/first-dir
  623.         rm -rf first-dir
  624.         ;;
  625.  
  626.     deep)
  627.       # Test the ability to operate on directories nested rather deeply.
  628.       mkdir ${CVSROOT_DIRNAME}/first-dir
  629.       dotest deep-1 "${testcvs} -q co first-dir" ''
  630.       cd first-dir
  631.       for i in dir1 dir2 dir3 dir4 dir5 dir6 dir7 dir8; do
  632.         mkdir $i
  633.         dotest deep-2-$i "${testcvs} add $i" \
  634. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/dir1[/dir0-9]* added to the repository'
  635.         cd $i
  636.         echo file1 >file1
  637.         dotest deep-3-$i "${testcvs} add file1" \
  638. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
  639. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  640.       done
  641.       cd ../../../../../../../../..
  642.       dotest deep-4 "${testcvs} -q ci -m add-them first-dir" \
  643. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/file1,v
  644. done
  645. Checking in first-dir/dir1/file1;
  646. /tmp/cvs-sanity/cvsroot/first-dir/dir1/file1,v  <--  file1
  647. initial revision: 1.1
  648. done
  649. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/file1,v
  650. done
  651. Checking in first-dir/dir1/dir2/file1;
  652. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/file1,v  <--  file1
  653. initial revision: 1.1
  654. done
  655. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/file1,v
  656. done
  657. Checking in first-dir/dir1/dir2/dir3/file1;
  658. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/file1,v  <--  file1
  659. initial revision: 1.1
  660. done
  661. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/file1,v
  662. done
  663. Checking in first-dir/dir1/dir2/dir3/dir4/file1;
  664. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/file1,v  <--  file1
  665. initial revision: 1.1
  666. done
  667. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v
  668. done
  669. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/file1;
  670. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
  671. initial revision: 1.1
  672. done
  673. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v
  674. done
  675. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1;
  676. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
  677. initial revision: 1.1
  678. done
  679. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v
  680. done
  681. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1;
  682. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v  <--  file1
  683. initial revision: 1.1
  684. done
  685. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v
  686. done
  687. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1;
  688. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
  689. initial revision: 1.1
  690. done'
  691.  
  692.       if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE}; then
  693.         pass deep-5
  694.       else
  695.         fail deep-5
  696.       fi
  697.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  698.       ;;
  699.  
  700.     basic2)
  701.         # Test rtag, import, history, various miscellaneous operations
  702.  
  703.         # First empty the history file
  704.         rm ${CVSROOT_DIRNAME}/CVSROOT/history
  705.         touch ${CVSROOT_DIRNAME}/CVSROOT/history
  706.  
  707.         mkdir ${CVSROOT_DIRNAME}/first-dir
  708.         dotest basic2-1 "${testcvs} -q co first-dir" ''
  709.         for i in first-dir dir1 dir2 ; do
  710.             if [ ! -d $i ] ; then
  711.                 mkdir $i
  712.                 if ${CVS} add $i  >> ${LOGFILE}; then
  713.                   echo "PASS: test 29-$i" >>${LOGFILE}
  714.                 else
  715.                   echo "FAIL: test 29-$i" | tee -a ${LOGFILE} ; exit 1
  716.                 fi
  717.             fi
  718.  
  719.             cd $i
  720.  
  721.             for j in file6 file7; do
  722.                 echo $j > $j
  723.             done
  724.  
  725.             if ${CVS} add file6 file7  2>> ${LOGFILE}; then
  726.                 echo "PASS: test 30-$i-$j" >>${LOGFILE}
  727.             else
  728.                 echo "FAIL: test 30-$i-$j" | tee -a ${LOGFILE} ; exit 1
  729.             fi
  730.         done
  731.         cd ../../..
  732.         if ${CVS} update first-dir  ; then
  733.             echo "PASS: test 31" >>${LOGFILE}
  734.         else
  735.             echo "FAIL: test 31" | tee -a ${LOGFILE} ; exit 1
  736.         fi
  737.  
  738.         # fixme: doesn't work right for added files.
  739.         if ${CVS} log first-dir  >> ${LOGFILE}; then
  740.             echo "PASS: test 32" >>${LOGFILE}
  741.         else
  742.             echo "FAIL: test 32" | tee -a ${LOGFILE} # ; exit 1
  743.         fi
  744.  
  745.         if ${CVS} status first-dir  >> ${LOGFILE}; then
  746.             echo "PASS: test 33" >>${LOGFILE}
  747.         else
  748.             echo "FAIL: test 33" | tee -a ${LOGFILE} ; exit 1
  749.         fi
  750.  
  751. #        if ${CVS} diff -u first-dir   >> ${LOGFILE} || [ $? = 1 ] ; then
  752. #            echo "PASS: test 34" >>${LOGFILE}
  753. #        else
  754. #            echo "FAIL: test 34" | tee -a ${LOGFILE} # ; exit 1
  755. #        fi
  756.  
  757.         if ${CVS} ci -m "second dive" first-dir  >> ${LOGFILE} 2>&1; then
  758.             echo "PASS: test 35" >>${LOGFILE}
  759.         else
  760.             echo "FAIL: test 35" | tee -a ${LOGFILE} ; exit 1
  761.         fi
  762.  
  763.         if ${CVS} tag second-dive first-dir  ; then
  764.             echo "PASS: test 36" >>${LOGFILE}
  765.         else
  766.             echo "FAIL: test 36" | tee -a ${LOGFILE} ; exit 1
  767.         fi
  768.  
  769.         # third dive - in bunch o' directories, add bunch o' files,
  770.         # delete some, change some.
  771.  
  772.         for i in first-dir dir1 dir2 ; do
  773.             cd $i
  774.  
  775.             # modify a file
  776.             echo file6 >>file6
  777.  
  778.             # delete a file
  779.             rm file7
  780.  
  781.             if ${CVS} rm file7  2>> ${LOGFILE}; then
  782.                 echo "PASS: test 37-$i" >>${LOGFILE}
  783.             else
  784.                 echo "FAIL: test 37-$i" | tee -a ${LOGFILE} ; exit 1
  785.             fi
  786.  
  787.             # and add a new file
  788.             echo file14 >file14
  789.  
  790.             if ${CVS} add file14  2>> ${LOGFILE}; then
  791.                 echo "PASS: test 38-$i" >>${LOGFILE}
  792.             else
  793.                 echo "FAIL: test 38-$i" | tee -a ${LOGFILE} ; exit 1
  794.             fi
  795.         done
  796.         cd ../../..
  797.         if ${CVS} update first-dir  ; then
  798.             echo "PASS: test 39" >>${LOGFILE}
  799.         else
  800.             echo "FAIL: test 39" | tee -a ${LOGFILE} ; exit 1
  801.         fi
  802.  
  803.         # fixme: doesn't work right for added files
  804.         if ${CVS} log first-dir  >> ${LOGFILE}; then
  805.             echo "PASS: test 40" >>${LOGFILE}
  806.         else
  807.             echo "FAIL: test 40" | tee -a ${LOGFILE} # ; exit 1
  808.         fi
  809.  
  810.         if ${CVS} status first-dir  >> ${LOGFILE}; then
  811.             echo "PASS: test 41" >>${LOGFILE}
  812.         else
  813.             echo "FAIL: test 41" | tee -a ${LOGFILE} ; exit 1
  814.         fi
  815.  
  816. #        if ${CVS} diff -u first-dir  >> ${LOGFILE} || [ $? = 1 ] ; then
  817. #            echo "PASS: test 42" >>${LOGFILE}
  818. #        else
  819. #            echo "FAIL: test 42" | tee -a ${LOGFILE} # ; exit 1
  820. #        fi
  821.  
  822.         if ${CVS} ci -m "third dive" first-dir  >>${LOGFILE} 2>&1; then
  823.             echo "PASS: test 43" >>${LOGFILE}
  824.         else
  825.             echo "FAIL: test 43" | tee -a ${LOGFILE} ; exit 1
  826.         fi
  827.         dotest 43.5 "${testcvs} -q update first-dir" ''
  828.  
  829.         if ${CVS} tag third-dive first-dir  ; then
  830.             echo "PASS: test 44" >>${LOGFILE}
  831.         else
  832.             echo "FAIL: test 44" | tee -a ${LOGFILE} ; exit 1
  833.         fi
  834.  
  835.         if echo "yes" | ${CVS} release -d first-dir  ; then
  836.             echo "PASS: test 45" >>${LOGFILE}
  837.         else
  838.             echo "FAIL: test 45" | tee -a ${LOGFILE} ; exit 1
  839.         fi
  840.  
  841.         # end of third dive
  842.         if [ -d first-dir ] ; then
  843.             echo "FAIL: test 45.5" | tee -a ${LOGFILE} ; exit 1
  844.         else
  845.             echo "PASS: test 45.5" >>${LOGFILE}
  846.         fi
  847.  
  848.         # now try some rtags
  849.  
  850.         # rtag HEADS
  851.         if ${CVS} rtag rtagged-by-head first-dir  ; then
  852.             echo "PASS: test 46" >>${LOGFILE}
  853.         else
  854.             echo "FAIL: test 46" | tee -a ${LOGFILE} ; exit 1
  855.         fi
  856.  
  857.         # tag by tag
  858.         if ${CVS} rtag -r rtagged-by-head rtagged-by-tag first-dir  ; then
  859.             echo "PASS: test 47" >>${LOGFILE}
  860.         else
  861.             echo "FAIL: test 47" | tee -a ${LOGFILE} ; exit 1
  862.         fi
  863.  
  864.         # tag by revision
  865.         if ${CVS} rtag -r1.1 rtagged-by-revision first-dir  ; then
  866.             echo "PASS: test 48" >>${LOGFILE}
  867.         else
  868.             echo "FAIL: test 48" | tee -a ${LOGFILE} ; exit 1
  869.         fi
  870.  
  871.         # rdiff by revision
  872.         if ${CVS} rdiff -r1.1 -rrtagged-by-head first-dir  >> ${LOGFILE} || [ $? = 1 ] ; then
  873.             echo "PASS: test 49" >>${LOGFILE}
  874.         else
  875.             echo "FAIL: test 49" | tee -a ${LOGFILE} ; exit 1
  876.         fi
  877.  
  878.         # now export by rtagged-by-head and rtagged-by-tag and compare.
  879.         rm -rf first-dir
  880.         if ${CVS} export -r rtagged-by-head first-dir  ; then
  881.             echo "PASS: test 50" >>${LOGFILE}
  882.         else
  883.             echo "FAIL: test 50" | tee -a ${LOGFILE} ; exit 1
  884.         fi
  885.  
  886.         mv first-dir 1dir
  887.         if ${CVS} export -r rtagged-by-tag first-dir  ; then
  888.             echo "PASS: test 51" >>${LOGFILE}
  889.         else
  890.             echo "FAIL: test 51" | tee -a ${LOGFILE} ; exit 1
  891.         fi
  892.  
  893.         directory_cmp 1dir first-dir
  894.  
  895.         if $ISDIFF ; then
  896.             echo "FAIL: test 52" | tee -a ${LOGFILE} ; exit 1
  897.         else
  898.             echo "PASS: test 52" >>${LOGFILE}
  899.         fi
  900.         rm -rf 1dir first-dir
  901.  
  902.         # checkout by revision vs export by rtagged-by-revision and compare.
  903.         if ${CVS} export -rrtagged-by-revision -d export-dir first-dir  ; then
  904.             echo "PASS: test 53" >>${LOGFILE}
  905.         else
  906.             echo "FAIL: test 53" | tee -a ${LOGFILE} ; exit 1
  907.         fi
  908.  
  909.         if ${CVS} co -r1.1 first-dir  ; then
  910.             echo "PASS: test 54" >>${LOGFILE}
  911.         else
  912.             echo "FAIL: test 54" | tee -a ${LOGFILE} ; exit 1
  913.         fi
  914.  
  915.         # directory copies are done in an oblique way in order to avoid a bug in sun's tmp filesystem.
  916.         mkdir first-dir.cpy ; (cd first-dir ; tar cf - * | (cd ../first-dir.cpy ; tar xf -))
  917.  
  918.         directory_cmp first-dir export-dir
  919.  
  920.         if $ISDIFF ; then 
  921.             echo "FAIL: test 55" | tee -a ${LOGFILE} ; exit 1
  922.         else
  923.             echo "PASS: test 55" >>${LOGFILE}
  924.         fi
  925.  
  926.         # interrupt, while we've got a clean 1.1 here, let's import it into another tree.
  927.         cd export-dir
  928.         dotest 56 "${testcvs} import -m first-import second-dir first-immigration immigration1 immigration1_0" \
  929. 'N second-dir/file14
  930. N second-dir/file6
  931. N second-dir/file7
  932. '"${PROG}"' [a-z]*: Importing /tmp/cvs-sanity/cvsroot/second-dir/dir1
  933. N second-dir/dir1/file14
  934. N second-dir/dir1/file6
  935. N second-dir/dir1/file7
  936. '"${PROG}"' [a-z]*: Importing /tmp/cvs-sanity/cvsroot/second-dir/dir1/dir2
  937. N second-dir/dir1/dir2/file14
  938. N second-dir/dir1/dir2/file6
  939. N second-dir/dir1/dir2/file7
  940.  
  941. No conflicts created by this import'
  942.  
  943.         cd ..
  944.  
  945.         if ${CVS} export -r HEAD second-dir  ; then
  946.             echo "PASS: test 57" >>${LOGFILE}
  947.         else
  948.             echo "FAIL: test 57" | tee -a ${LOGFILE} ; exit 1
  949.         fi
  950.  
  951.         directory_cmp first-dir second-dir
  952.  
  953.         if $ISDIFF ; then
  954.             echo "FAIL: test 58" | tee -a ${LOGFILE} ; exit 1
  955.         else
  956.             echo "PASS: test 58" >>${LOGFILE}
  957.         fi
  958.  
  959.         rm -rf second-dir
  960.         rm -rf export-dir first-dir
  961.         mkdir first-dir
  962.         (cd first-dir.cpy ; tar cf - * | (cd ../first-dir ; tar xf -))
  963.  
  964.         # update the top, cancelling sticky tags, retag, update other copy, compare.
  965.         cd first-dir
  966.         if ${CVS} update -A -l *file*  2>> ${LOGFILE}; then
  967.             echo "PASS: test 59" >>${LOGFILE}
  968.         else
  969.             echo "FAIL: test 59" | tee -a ${LOGFILE} ; exit 1
  970.         fi
  971.  
  972.         # If we don't delete the tag first, cvs won't retag it.
  973.         # This would appear to be a feature.
  974.         if ${CVS} tag -l -d rtagged-by-revision  ; then
  975.             echo "PASS: test 60a" >>${LOGFILE}
  976.         else
  977.             echo "FAIL: test 60a" | tee -a ${LOGFILE} ; exit 1
  978.         fi
  979.         if ${CVS} tag -l rtagged-by-revision  ; then
  980.             echo "PASS: test 60b" >>${LOGFILE}
  981.         else
  982.             echo "FAIL: test 60b" | tee -a ${LOGFILE} ; exit 1
  983.         fi
  984.  
  985.         cd ..
  986.         mv first-dir 1dir
  987.         mv first-dir.cpy first-dir
  988.         cd first-dir
  989.  
  990.         dotest 61 "${testcvs} -q diff -u" ''
  991.  
  992.         if ${CVS} update  ; then
  993.             echo "PASS: test 62" >>${LOGFILE}
  994.         else
  995.             echo "FAIL: test 62" | tee -a ${LOGFILE} ; exit 1
  996.         fi
  997.  
  998.         cd ..
  999.  
  1000.         #### FIXME: is this expected to work???  Need to investigate
  1001.         #### and fix or remove the test.
  1002. #        directory_cmp 1dir first-dir
  1003. #
  1004. #        if $ISDIFF ; then
  1005. #            echo "FAIL: test 63" | tee -a ${LOGFILE} # ; exit 1
  1006. #        else
  1007. #            echo "PASS: test 63" >>${LOGFILE}
  1008. #        fi
  1009.         rm -rf 1dir first-dir
  1010.  
  1011.         # Test the cvs history command.
  1012.  
  1013.         # The reason that there are two patterns rather than using
  1014.         # \(/tmp/cvs-sanity\|<remote>\) is that we are trying to
  1015.         # make this portable.  Perhaps at some point we should
  1016.         # ditch that notion and require GNU expr (or dejagnu or....)
  1017.         # since it seems to be so painful.
  1018.  
  1019.         # why are there two lines at the end of the local output
  1020.         # which don't exist in the remote output?  would seem to be
  1021.         # a CVS bug.
  1022.         dotest basic2-64 "${testcvs} his -e -a" \
  1023. 'O [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* first-dir           =first-dir= /tmp/cvs-sanity/\*
  1024. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file6     first-dir           == /tmp/cvs-sanity
  1025. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file7     first-dir           == /tmp/cvs-sanity
  1026. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file6     first-dir/dir1      == /tmp/cvs-sanity
  1027. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file7     first-dir/dir1      == /tmp/cvs-sanity
  1028. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file6     first-dir/dir1/dir2 == /tmp/cvs-sanity
  1029. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file7     first-dir/dir1/dir2 == /tmp/cvs-sanity
  1030. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file14    first-dir           == /tmp/cvs-sanity
  1031. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.2 file6     first-dir           == /tmp/cvs-sanity
  1032. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file14    first-dir/dir1      == /tmp/cvs-sanity
  1033. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.2 file6     first-dir/dir1      == /tmp/cvs-sanity
  1034. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file14    first-dir/dir1/dir2 == /tmp/cvs-sanity
  1035. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.2 file6     first-dir/dir1/dir2 == /tmp/cvs-sanity
  1036. F [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]*                     =first-dir= /tmp/cvs-sanity/\*
  1037. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* first-dir \[rtagged-by-head:A\]
  1038. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* first-dir \[rtagged-by-tag:rtagged-by-head\]
  1039. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* first-dir \[rtagged-by-revision:1.1\]
  1040. O [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* \[1.1\] first-dir           =first-dir= /tmp/cvs-sanity/\*
  1041. U [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.2 file6     first-dir           == /tmp/cvs-sanity/first-dir
  1042. U [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.2 file7     first-dir           == /tmp/cvs-sanity/first-dir' \
  1043. 'O [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* first-dir           =first-dir= <remote>/\*
  1044. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file6     first-dir           == <remote>
  1045. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file7     first-dir           == <remote>
  1046. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file6     first-dir/dir1      == <remote>
  1047. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file7     first-dir/dir1      == <remote>
  1048. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file6     first-dir/dir1/dir2 == <remote>
  1049. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file7     first-dir/dir1/dir2 == <remote>
  1050. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file14    first-dir           == <remote>
  1051. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.2 file6     first-dir           == <remote>
  1052. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file14    first-dir/dir1      == <remote>
  1053. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.2 file6     first-dir/dir1      == <remote>
  1054. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.1 file14    first-dir/dir1/dir2 == <remote>
  1055. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* 1.2 file6     first-dir/dir1/dir2 == <remote>
  1056. F [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]*                     =first-dir= <remote>/\*
  1057. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* first-dir \[rtagged-by-head:A\]
  1058. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* first-dir \[rtagged-by-tag:rtagged-by-head\]
  1059. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* first-dir \[rtagged-by-revision:1.1\]
  1060. O [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z@][a-z@]* \[1.1\] first-dir           =first-dir= <remote>/\*'
  1061.  
  1062.         rm -rf ${CVSROOT_DIRNAME}/first-dir
  1063.         rm -rf ${CVSROOT_DIRNAME}/second-dir
  1064.         ;;
  1065.  
  1066.     death) # next dive.  test death support.
  1067.         mkdir  ${CVSROOT_DIRNAME}/first-dir
  1068.         if ${CVS} co first-dir  ; then
  1069.             echo "PASS: test 65" >>${LOGFILE}
  1070.         else
  1071.             echo "FAIL: test 65" | tee -a ${LOGFILE} ; exit 1
  1072.         fi
  1073.  
  1074.         cd first-dir
  1075.  
  1076.         # Create a directory with only dead files, to make sure CVS
  1077.         # doesn't get confused by it.
  1078.         mkdir subdir
  1079.         dotest 65a0 "${testcvs} add subdir" \
  1080. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/subdir added to the repository'
  1081.         cd subdir
  1082.         echo file in subdir >sfile
  1083.         dotest 65a1 "${testcvs} add sfile" \
  1084. "${PROG}"' [a-z]*: scheduling file `sfile'\'' for addition
  1085. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  1086.         dotest 65a2 "${testcvs} -q ci -m add-it" \
  1087. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/subdir/sfile,v
  1088. done
  1089. Checking in sfile;
  1090. /tmp/cvs-sanity/cvsroot/first-dir/subdir/sfile,v  <--  sfile
  1091. initial revision: 1.1
  1092. done'
  1093.         rm sfile
  1094.         dotest 65a3 "${testcvs} rm sfile" \
  1095. "${PROG}"' [a-z]*: scheduling `sfile'\'' for removal
  1096. '"${PROG}"' [a-z]*: use '\'"${PROG}"' commit'\'' to remove this file permanently'
  1097.         dotest 65a4 "${testcvs} -q ci -m remove-it" \
  1098. 'Removing sfile;
  1099. /tmp/cvs-sanity/cvsroot/first-dir/subdir/sfile,v  <--  sfile
  1100. new revision: delete; previous revision: 1.1
  1101. done'
  1102.         cd ..
  1103.         dotest 65a5 "${testcvs} -q update -P" ''
  1104.         dotest_fail 65a6 "test -d subdir" ''
  1105.  
  1106.         # add a file.
  1107.         touch file1
  1108.         if ${CVS} add file1  2>> ${LOGFILE}; then
  1109.             echo "PASS: test 66" >>${LOGFILE}
  1110.         else
  1111.             echo "FAIL: test 66" | tee -a ${LOGFILE} ; exit 1
  1112.         fi
  1113.  
  1114.         # commit
  1115.         if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
  1116.             echo "PASS: test 67" >>${LOGFILE}
  1117.         else
  1118.             echo "FAIL: test 67" | tee -a ${LOGFILE} ; exit 1
  1119.         fi
  1120.  
  1121.         # remove
  1122.         rm file1
  1123.         if ${CVS} rm file1  2>> ${LOGFILE}; then
  1124.             echo "PASS: test 68" >>${LOGFILE}
  1125.         else
  1126.             echo "FAIL: test 68" | tee -a ${LOGFILE} ; exit 1
  1127.         fi
  1128.  
  1129.         # commit
  1130.         if ${CVS} ci -m test  >>${LOGFILE} ; then
  1131.             echo "PASS: test 69" >>${LOGFILE}
  1132.         else
  1133.             echo "FAIL: test 69" | tee -a ${LOGFILE} ; exit 1
  1134.         fi
  1135.  
  1136.         dotest_fail 69a0 "test -f file1" ''
  1137.         # get the old contents of file1 back
  1138.         if ${testcvs} update -p -r 1.1 file1 >file1 2>>${LOGFILE}; then
  1139.           pass 69a1
  1140.         else
  1141.           fail 69a1
  1142.         fi
  1143.         dotest 69a2 "cat file1" ''
  1144.  
  1145.         # create second file
  1146.         touch file2
  1147.         if ${CVS} add file1 file2  2>> ${LOGFILE}; then
  1148.             echo "PASS: test 70" >>${LOGFILE}
  1149.         else
  1150.             echo "FAIL: test 70" | tee -a ${LOGFILE} ; exit 1
  1151.         fi
  1152.  
  1153.         # commit
  1154.         if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
  1155.             echo "PASS: test 71" >>${LOGFILE}
  1156.         else
  1157.             echo "FAIL: test 71" | tee -a ${LOGFILE} ; exit 1
  1158.         fi
  1159.  
  1160.         # log
  1161.         if ${CVS} log file1  >> ${LOGFILE}; then
  1162.             echo "PASS: test 72" >>${LOGFILE}
  1163.         else
  1164.             echo "FAIL: test 72" | tee -a ${LOGFILE} ; exit 1
  1165.         fi
  1166.  
  1167.         # file4 will be dead at the time of branching and stay dead.
  1168.         echo file4 > file4
  1169.         dotest death-file4-add "${testcvs} add file4" \
  1170. "${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
  1171. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  1172.         dotest death-file4-ciadd "${testcvs} -q ci -m add file4" \
  1173. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  1174. done
  1175. Checking in file4;
  1176. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1177. initial revision: 1.1
  1178. done'
  1179.         rm file4
  1180.         dotest death-file4-rm "${testcvs} remove file4" \
  1181. "${PROG}"' [a-z]*: scheduling `file4'\'' for removal
  1182. '"${PROG}"' [a-z]*: use '\'"${PROG}"' commit'\'' to remove this file permanently'
  1183.         dotest death-file4-cirm "${testcvs} -q ci -m remove file4" \
  1184. 'Removing file4;
  1185. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1186. new revision: delete; previous revision: 1.1
  1187. done'
  1188.  
  1189.         # branch1
  1190.         if ${CVS} tag -b branch1  ; then
  1191.             echo "PASS: test 73" >>${LOGFILE}
  1192.         else
  1193.             echo "FAIL: test 73" | tee -a ${LOGFILE} ; exit 1
  1194.         fi
  1195.  
  1196.         # and move to the branch.
  1197.         if ${CVS} update -r branch1  ; then
  1198.             echo "PASS: test 74" >>${LOGFILE}
  1199.         else
  1200.             echo "FAIL: test 74" | tee -a ${LOGFILE} ; exit 1
  1201.         fi
  1202.  
  1203.         dotest_fail death-file4-3 "test -f file4" ''
  1204.  
  1205.         # add a file in the branch
  1206.         echo line1 from branch1 >> file3
  1207.         if ${CVS} add file3  2>> ${LOGFILE}; then
  1208.             echo "PASS: test 75" >>${LOGFILE}
  1209.         else
  1210.             echo "FAIL: test 75" | tee -a ${LOGFILE} ; exit 1
  1211.         fi
  1212.  
  1213.         # commit
  1214.         if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
  1215.             echo "PASS: test 76" >>${LOGFILE}
  1216.         else
  1217.             echo "FAIL: test 76" | tee -a ${LOGFILE} ; exit 1
  1218.         fi
  1219.  
  1220.         # remove
  1221.         rm file3
  1222.         if ${CVS} rm file3  2>> ${LOGFILE}; then
  1223.             echo "PASS: test 77" >>${LOGFILE}
  1224.         else
  1225.             echo "FAIL: test 77" | tee -a ${LOGFILE} ; exit 1
  1226.         fi
  1227.  
  1228.         # commit
  1229.         if ${CVS} ci -m test  >>${LOGFILE} ; then
  1230.             echo "PASS: test 78" >>${LOGFILE}
  1231.         else
  1232.             echo "FAIL: test 78" | tee -a ${LOGFILE} ; exit 1
  1233.         fi
  1234.  
  1235.         # add again
  1236.         echo line1 from branch1 >> file3
  1237.         if ${CVS} add file3  2>> ${LOGFILE}; then
  1238.             echo "PASS: test 79" >>${LOGFILE}
  1239.         else
  1240.             echo "FAIL: test 79" | tee -a ${LOGFILE} ; exit 1
  1241.         fi
  1242.  
  1243.         # commit
  1244.         if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
  1245.             echo "PASS: test 80" >>${LOGFILE}
  1246.         else
  1247.             echo "FAIL: test 80" | tee -a ${LOGFILE} ; exit 1
  1248.         fi
  1249.  
  1250.         # change the first file
  1251.         echo line2 from branch1 >> file1
  1252.  
  1253.         # commit
  1254.         if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
  1255.             echo "PASS: test 81" >>${LOGFILE}
  1256.         else
  1257.             echo "FAIL: test 81" | tee -a ${LOGFILE} ; exit 1
  1258.         fi
  1259.  
  1260.         # remove the second
  1261.         rm file2
  1262.         if ${CVS} rm file2  2>> ${LOGFILE}; then
  1263.             echo "PASS: test 82" >>${LOGFILE}
  1264.         else
  1265.             echo "FAIL: test 82" | tee -a ${LOGFILE} ; exit 1
  1266.         fi
  1267.  
  1268.         # commit
  1269.         if ${CVS} ci -m test  >>${LOGFILE}; then
  1270.             echo "PASS: test 83" >>${LOGFILE}
  1271.         else
  1272.             echo "FAIL: test 83" | tee -a ${LOGFILE} ; exit 1
  1273.         fi
  1274.  
  1275.         # back to the trunk.
  1276.         if ${CVS} update -A  2>> ${LOGFILE}; then
  1277.             echo "PASS: test 84" >>${LOGFILE}
  1278.         else
  1279.             echo "FAIL: test 84" | tee -a ${LOGFILE} ; exit 1
  1280.         fi
  1281.  
  1282.         dotest_fail death-file4-4 "test -f file4" ''
  1283.  
  1284.         if [ -f file3 ] ; then
  1285.             echo "FAIL: test 85" | tee -a ${LOGFILE} ; exit 1
  1286.         else
  1287.             echo "PASS: test 85" >>${LOGFILE}
  1288.         fi
  1289.  
  1290.         # join
  1291.         if ${CVS} update -j branch1  >> ${LOGFILE} 2>&1; then
  1292.             echo "PASS: test 86" >>${LOGFILE}
  1293.         else
  1294.             echo "FAIL: test 86" | tee -a ${LOGFILE} ; exit 1
  1295.         fi
  1296.  
  1297.         dotest_fail death-file4-5 "test -f file4" ''
  1298.  
  1299.         if [ -f file3 ] ; then
  1300.             echo "PASS: test 87" >>${LOGFILE}
  1301.         else
  1302.             echo "FAIL: test 87" | tee -a ${LOGFILE} ; exit 1
  1303.         fi
  1304.  
  1305.         # Make sure that we joined the correct change to file1
  1306.         if echo line2 from branch1 | cmp - file1 >/dev/null; then
  1307.             echo 'PASS: test 87a' >>${LOGFILE}
  1308.         else
  1309.             echo 'FAIL: test 87a' | tee -a ${LOGFILE}
  1310.             exit 1
  1311.         fi
  1312.  
  1313.         # update
  1314.         if ${CVS} update  ; then
  1315.             echo "PASS: test 88" >>${LOGFILE}
  1316.         else
  1317.             echo "FAIL: test 88" | tee -a ${LOGFILE} ; exit 1
  1318.         fi
  1319.  
  1320.         # commit
  1321.         if ${CVS} ci -m test  >>${LOGFILE} 2>&1; then
  1322.             echo "PASS: test 89" >>${LOGFILE}
  1323.         else
  1324.             echo "FAIL: test 89" | tee -a ${LOGFILE} ; exit 1
  1325.         fi
  1326.  
  1327.         # remove first file.
  1328.         rm file1
  1329.         if ${CVS} rm file1  2>> ${LOGFILE}; then
  1330.             echo "PASS: test 90" >>${LOGFILE}
  1331.         else
  1332.             echo "FAIL: test 90" | tee -a ${LOGFILE} ; exit 1
  1333.         fi
  1334.  
  1335.         # commit
  1336.         if ${CVS} ci -m test  >>${LOGFILE}; then
  1337.             echo "PASS: test 91" >>${LOGFILE}
  1338.         else
  1339.             echo "FAIL: test 91" | tee -a ${LOGFILE} ; exit 1
  1340.         fi
  1341.  
  1342.         if [ -f file1 ] ; then
  1343.             echo "FAIL: test 92" | tee -a ${LOGFILE} ; exit 1
  1344.         else
  1345.             echo "PASS: test 92" >>${LOGFILE}
  1346.         fi
  1347.  
  1348.         # typo; try to get to the branch and fail
  1349.         dotest_fail 92.1a "${testcvs} update -r brnach1" \
  1350.           "${PROG}"' \[[a-z]* aborted\]: no such tag brnach1'
  1351.         # Make sure we are still on the trunk
  1352.         if test -f file1 ; then
  1353.             echo "FAIL: 92.1b" | tee -a ${LOGFILE} ; exit 1
  1354.         else
  1355.             echo "PASS: 92.1b" >>${LOGFILE}
  1356.         fi
  1357.         if test -f file2 ; then
  1358.             echo "PASS: 92.1c" >>${LOGFILE}
  1359.         else
  1360.             echo "FAIL: 92.1c" | tee -a ${LOGFILE} ; exit 1
  1361.         fi
  1362.  
  1363.         # back to branch1
  1364.         if ${CVS} update -r branch1  2>> ${LOGFILE}; then
  1365.             echo "PASS: test 93" >>${LOGFILE}
  1366.         else
  1367.             echo "FAIL: test 93" | tee -a ${LOGFILE} ; exit 1
  1368.         fi
  1369.  
  1370.         dotest_fail death-file4-6 "test -f file4" ''
  1371.  
  1372.         if [ -f file1 ] ; then
  1373.             echo "PASS: test 94" >>${LOGFILE}
  1374.         else
  1375.             echo "FAIL: test 94" | tee -a ${LOGFILE} ; exit 1
  1376.         fi
  1377.  
  1378.         # and join
  1379.         if ${CVS} update -j HEAD  >> ${LOGFILE} 2>&1; then
  1380.             echo "PASS: test 95" >>${LOGFILE}
  1381.         else
  1382.             echo "FAIL: test 95" | tee -a ${LOGFILE} ; exit 1
  1383.         fi
  1384.  
  1385.         dotest_fail death-file4-7 "test -f file4" ''
  1386.  
  1387.         cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  1388.         ;;
  1389.     branches)
  1390.       # More branch tests, including branches off of branches
  1391.       mkdir ${CVSROOT_DIRNAME}/first-dir
  1392.       dotest branches-1 "${testcvs} -q co first-dir" ''
  1393.       cd first-dir
  1394.       echo 1:ancest >file1
  1395.       echo 2:ancest >file2
  1396.       echo 3:ancest >file3
  1397.       echo 4:trunk-1 >file4
  1398.       dotest branches-2 "${testcvs} add file1 file2 file3 file4" \
  1399. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
  1400. '"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
  1401. '"${PROG}"' [a-z]*: scheduling file `file3'\'' for addition
  1402. '"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
  1403. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
  1404.       dotest branches-3 "${testcvs} -q ci -m add-it" \
  1405. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  1406. done
  1407. Checking in file1;
  1408. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  1409. initial revision: 1.1
  1410. done
  1411. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file2,v
  1412. done
  1413. Checking in file2;
  1414. /tmp/cvs-sanity/cvsroot/first-dir/file2,v  <--  file2
  1415. initial revision: 1.1
  1416. done
  1417. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file3,v
  1418. done
  1419. Checking in file3;
  1420. /tmp/cvs-sanity/cvsroot/first-dir/file3,v  <--  file3
  1421. initial revision: 1.1
  1422. done
  1423. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  1424. done
  1425. Checking in file4;
  1426. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1427. initial revision: 1.1
  1428. done'
  1429.       echo 4:trunk-2 >file4
  1430.       dotest branches-3.2 "${testcvs} -q ci -m trunk-before-branch" \
  1431. 'Checking in file4;
  1432. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1433. new revision: 1.2; previous revision: 1.1
  1434. done'
  1435.       dotest branches-4 "${testcvs} tag -b br1" "${PROG}"' [a-z]*: Tagging \.
  1436. T file1
  1437. T file2
  1438. T file3
  1439. T file4'
  1440.       dotest branches-5 "${testcvs} update -r br1" \
  1441. "${PROG}"' [a-z]*: Updating \.'
  1442.       echo 1:br1 >file1
  1443.       echo 2:br1 >file2
  1444.       echo 4:br1 >file4
  1445.       dotest branches-6 "${testcvs} -q ci -m modify" \
  1446. 'Checking in file1;
  1447. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  1448. new revision: 1.1.2.1; previous revision: 1.1
  1449. done
  1450. Checking in file2;
  1451. /tmp/cvs-sanity/cvsroot/first-dir/file2,v  <--  file2
  1452. new revision: 1.1.2.1; previous revision: 1.1
  1453. done
  1454. Checking in file4;
  1455. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1456. new revision: 1.2.2.1; previous revision: 1.2
  1457. done'
  1458.       dotest branches-7 "${testcvs} -q tag -b brbr" 'T file1
  1459. T file2
  1460. T file3
  1461. T file4'
  1462.       dotest branches-8 "${testcvs} -q update -r brbr" ''
  1463.       echo 1:brbr >file1
  1464.       echo 4:brbr >file4
  1465.       dotest branches-9 "${testcvs} -q ci -m modify" \
  1466. 'Checking in file1;
  1467. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  1468. new revision: 1.1.2.1.2.1; previous revision: 1.1.2.1
  1469. done
  1470. Checking in file4;
  1471. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1472. new revision: 1.2.2.1.2.1; previous revision: 1.2.2.1
  1473. done'
  1474.       dotest branches-10 "cat file1 file2 file3 file4" '1:brbr
  1475. 2:br1
  1476. 3:ancest
  1477. 4:brbr'
  1478.       dotest branches-11 "${testcvs} -q update -r br1" \
  1479. '[UP] file1
  1480. [UP] file4'
  1481.       dotest branches-12 "cat file1 file2 file3 file4" '1:br1
  1482. 2:br1
  1483. 3:ancest
  1484. 4:br1'
  1485.       echo 4:br1-2 >file4
  1486.       dotest branches-12.2 "${testcvs} -q ci -m change-on-br1" \
  1487. 'Checking in file4;
  1488. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1489. new revision: 1.2.2.2; previous revision: 1.2.2.1
  1490. done'
  1491.       dotest branches-13 "${testcvs} -q update -A" '[UP] file1
  1492. [UP] file2
  1493. [UP] file4'
  1494.       dotest branches-14 "cat file1 file2 file3 file4" '1:ancest
  1495. 2:ancest
  1496. 3:ancest
  1497. 4:trunk-2'
  1498.       echo 4:trunk-3 >file4
  1499.       dotest branches-14.2 \
  1500.         "${testcvs} -q ci -m trunk-change-after-branch" \
  1501. 'Checking in file4;
  1502. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1503. new revision: 1.3; previous revision: 1.2
  1504. done'
  1505.       dotest branches-14.3 "${testcvs} log file4" \
  1506. '
  1507. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  1508. Working file: file4
  1509. head: 1\.3
  1510. branch:
  1511. locks: strict
  1512. access list:
  1513. symbolic names:
  1514.     brbr: 1\.2\.2\.1\.0\.2
  1515.     br1: 1\.2\.0\.2
  1516. keyword substitution: kv
  1517. total revisions: 6;    selected revisions: 6
  1518. description:
  1519. ----------------------------
  1520. revision 1\.3
  1521. date: [0-9/: ]*;  author: [a-z@][a-z@]*;  state: Exp;  lines: '"${PLUS}"'1 -1
  1522. trunk-change-after-branch
  1523. ----------------------------
  1524. revision 1\.2
  1525. date: [0-9/: ]*;  author: [a-z@][a-z@]*;  state: Exp;  lines: '"${PLUS}"'1 -1
  1526. branches:  1\.2\.2;
  1527. trunk-before-branch
  1528. ----------------------------
  1529. revision 1\.1
  1530. date: [0-9/: ]*;  author: [a-z@][a-z@]*;  state: Exp;
  1531. add-it
  1532. ----------------------------
  1533. revision 1\.2\.2\.2
  1534. date: [0-9/: ]*;  author: [a-z@][a-z@]*;  state: Exp;  lines: '"${PLUS}"'1 -1
  1535. change-on-br1
  1536. ----------------------------
  1537. revision 1\.2\.2\.1
  1538. date: [0-9/: ]*;  author: [a-z@][a-z@]*;  state: Exp;  lines: '"${PLUS}"'1 -1
  1539. branches:  1\.2\.2\.1\.2;
  1540. modify
  1541. ----------------------------
  1542. revision 1\.2\.2\.1\.2\.1
  1543. date: [0-9/: ]*;  author: [a-z@][a-z@]*;  state: Exp;  lines: '"${PLUS}"'1 -1
  1544. modify
  1545. ============================================================================='
  1546.       dotest_status branches-14.4 1 \
  1547.         "${testcvs} diff -c -r 1.1 -r 1.3 file4" \
  1548. 'Index: file4
  1549. ===================================================================
  1550. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  1551. retrieving revision 1\.1
  1552. retrieving revision 1\.3
  1553. diff -c -r1\.1 -r1\.3
  1554. \*\*\* file4    [0-9/]* [0-9:]*    1\.1
  1555. --- file4    [0-9/]* [0-9:]*    1\.3
  1556. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1557. \*\*\* 1 \*\*\*\*
  1558. ! 4:trunk-1
  1559. --- 1 ----
  1560. ! 4:trunk-3'
  1561.       dotest_status branches-14.5 1 \
  1562.         "${testcvs} diff -c -r 1.1 -r 1.2.2.1 file4" \
  1563. 'Index: file4
  1564. ===================================================================
  1565. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  1566. retrieving revision 1\.1
  1567. retrieving revision 1\.2\.2\.1
  1568. diff -c -r1\.1 -r1\.2\.2\.1
  1569. \*\*\* file4    [0-9/]* [0-9:]*    1\.1
  1570. --- file4    [0-9/]* [0-9:]*    1\.2\.2\.1
  1571. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1572. \*\*\* 1 \*\*\*\*
  1573. ! 4:trunk-1
  1574. --- 1 ----
  1575. ! 4:br1'
  1576.       dotest branches-15 \
  1577.         "${testcvs} update -j 1.1.2.1 -j 1.1.2.1.2.1 file1" \
  1578.         'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  1579. retrieving revision 1.1.2.1
  1580. retrieving revision 1.1.2.1.2.1
  1581. Merging differences between 1.1.2.1 and 1.1.2.1.2.1 into file1
  1582. rcsmerge: warning: conflicts during merge'
  1583.       dotest branches-16 "cat file1" '<<<<<<< file1
  1584. 1:ancest
  1585. =======
  1586. 1:brbr
  1587. >>>>>>> 1.1.2.1.2.1'
  1588.       cd ..
  1589.  
  1590.       if test "$keep" = yes; then
  1591.         echo Keeping /tmp/cvs-sanity and exiting due to --keep
  1592.         exit 0
  1593.       fi
  1594.  
  1595.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  1596.       rm -r first-dir
  1597.       ;;
  1598.  
  1599.     import) # test death after import
  1600.         # import
  1601.         mkdir import-dir ; cd import-dir
  1602.  
  1603.         for i in 1 2 3 4 ; do
  1604.             echo imported file"$i" > imported-file"$i"
  1605.         done
  1606.  
  1607.         # This directory should be on the default ignore list,
  1608.         # so it shouldn't get imported.
  1609.         mkdir RCS
  1610.         echo ignore.me >RCS/ignore.me
  1611.  
  1612.         echo 'import should not expand $''Id$' >>imported-file2
  1613.         cp imported-file2 ../imported-file2-orig.tmp
  1614.  
  1615.         if ${CVS} import -m first-import first-dir vendor-branch junk-1_0  ; then
  1616.             echo "PASS: test 96" >>${LOGFILE}
  1617.         else
  1618.             echo "FAIL: test 96" | tee -a ${LOGFILE} ; exit 1
  1619.         fi
  1620.  
  1621.         if cmp ../imported-file2-orig.tmp imported-file2; then
  1622.           pass 96.5
  1623.         else
  1624.           fail 96.5
  1625.         fi
  1626.         cd ..
  1627.  
  1628.         # co
  1629.         if ${CVS} co first-dir  ; then
  1630.             echo "PASS: test 97" >>${LOGFILE}
  1631.         else
  1632.             echo "FAIL: test 97" | tee -a ${LOGFILE} ; exit 1
  1633.         fi
  1634.  
  1635.         cd first-dir
  1636.         for i in 1 2 3 4 ; do
  1637.             if [ -f imported-file"$i" ] ; then
  1638.                 echo "PASS: test 98-$i" >>${LOGFILE}
  1639.             else
  1640.                 echo "FAIL: test 98-$i" | tee -a ${LOGFILE} ; exit 1
  1641.             fi
  1642.         done
  1643.         if test -d RCS; then
  1644.           echo "FAIL: test 98.5" | tee -a ${LOGFILE} ; exit 1
  1645.         else
  1646.           echo "PASS: test 98.5" >>${LOGFILE}
  1647.         fi
  1648.  
  1649.         # remove
  1650.         rm imported-file1
  1651.         if ${CVS} rm imported-file1  2>> ${LOGFILE}; then
  1652.             echo "PASS: test 99" >>${LOGFILE}
  1653.         else
  1654.             echo "FAIL: test 99" | tee -a ${LOGFILE} ; exit 1
  1655.         fi
  1656.  
  1657.         # change
  1658.         # this sleep is significant.  Otherwise, on some machines, things happen so
  1659.         # fast that the file mod times do not differ.
  1660.         sleep 1
  1661.         echo local-change >> imported-file2
  1662.  
  1663.         # commit
  1664.         if ${CVS} ci -m local-changes  >> ${LOGFILE} 2>&1; then
  1665.             echo "PASS: test 100" >>${LOGFILE}
  1666.         else
  1667.             echo "FAIL: test 100" | tee -a ${LOGFILE} ; exit 1
  1668.         fi
  1669.  
  1670.         # log
  1671.         if ${CVS} log imported-file1 | grep '1.1.1.2 (dead)'  ; then
  1672.             echo "FAIL: test 101" | tee -a ${LOGFILE} ; exit 1
  1673.         else
  1674.             echo "PASS: test 101" >>${LOGFILE}
  1675.         fi
  1676.  
  1677.         # update into the vendor branch.
  1678.         if ${CVS} update -rvendor-branch  ; then
  1679.             echo "PASS: test 102" >>${LOGFILE}
  1680.         else
  1681.             echo "FAIL: test 102" | tee -a ${LOGFILE} ; exit 1
  1682.         fi
  1683.  
  1684.         # remove file4 on the vendor branch
  1685.         rm imported-file4
  1686.  
  1687.         if ${CVS} rm imported-file4  2>> ${LOGFILE}; then
  1688.             echo "PASS: test 103" >>${LOGFILE}
  1689.         else
  1690.             echo "FAIL: test 103" | tee -a ${LOGFILE} ; exit 1
  1691.         fi
  1692.  
  1693.         # commit
  1694.         if ${CVS} ci -m vendor-removed imported-file4 >>${LOGFILE}; then
  1695.             echo "PASS: test 104" >>${LOGFILE}
  1696.         else
  1697.             echo "FAIL: test 104" | tee -a ${LOGFILE} ; exit 1
  1698.         fi
  1699.  
  1700.         # update to main line
  1701.         if ${CVS} update -A  2>> ${LOGFILE}; then
  1702.             echo "PASS: test 105" >>${LOGFILE}
  1703.         else
  1704.             echo "FAIL: test 105" | tee -a ${LOGFILE} ; exit 1
  1705.         fi
  1706.  
  1707.         # second import - file4 deliberately unchanged
  1708.         cd ../import-dir
  1709.         for i in 1 2 3 ; do
  1710.             echo rev 2 of file $i >> imported-file"$i"
  1711.         done
  1712.         cp imported-file2 ../imported-file2-orig.tmp
  1713.  
  1714.         if ${CVS} import -m second-import first-dir vendor-branch junk-2_0  ; then
  1715.             echo "PASS: test 106" >>${LOGFILE}
  1716.         else
  1717.             echo "FAIL: test 106" | tee -a ${LOGFILE} ; exit 1
  1718.         fi
  1719.         if cmp ../imported-file2-orig.tmp imported-file2; then
  1720.           pass 106.5
  1721.         else
  1722.           fail 106.5
  1723.         fi
  1724.         cd ..
  1725.  
  1726.         # co
  1727.         if ${CVS} co first-dir  ; then
  1728.             echo "PASS: test 107" >>${LOGFILE}
  1729.         else
  1730.             echo "FAIL: test 107" | tee -a ${LOGFILE} ; exit 1
  1731.         fi
  1732.  
  1733.         cd first-dir
  1734.  
  1735.         if [ -f imported-file1 ] ; then
  1736.             echo "FAIL: test 108" | tee -a ${LOGFILE} ; exit 1
  1737.         else
  1738.             echo "PASS: test 108" >>${LOGFILE}
  1739.         fi
  1740.  
  1741.         for i in 2 3 ; do
  1742.             if [ -f imported-file"$i" ] ; then
  1743.                 echo "PASS: test 109-$i" >>${LOGFILE}
  1744.             else
  1745.                 echo "FAIL: test 109-$i" | tee -a ${LOGFILE} ; exit 1
  1746.             fi
  1747.         done
  1748.  
  1749.         # check vendor branch for file4
  1750.         if ${CVS} update -rvendor-branch  ; then
  1751.             echo "PASS: test 110" >>${LOGFILE}
  1752.         else
  1753.             echo "FAIL: test 110" | tee -a ${LOGFILE} ; exit 1
  1754.         fi
  1755.  
  1756.         if [ -f imported-file4 ] ; then
  1757.             echo "PASS: test 111" >>${LOGFILE}
  1758.         else
  1759.             echo "FAIL: test 111" | tee -a ${LOGFILE} ; exit 1
  1760.         fi
  1761.  
  1762.         # update to main line
  1763.         if ${CVS} update -A  2>> ${LOGFILE}; then
  1764.             echo "PASS: test 112" >>${LOGFILE}
  1765.         else
  1766.             echo "FAIL: test 112" | tee -a ${LOGFILE} ; exit 1
  1767.         fi
  1768.  
  1769.         cd ..
  1770.  
  1771.         if ${CVS} co -jjunk-1_0 -jjunk-2_0 first-dir  >>${LOGFILE} 2>&1; then
  1772.             echo "PASS: test 113" >>${LOGFILE}
  1773.         else
  1774.             echo "FAIL: test 113" | tee -a ${LOGFILE} ; exit 1
  1775.         fi
  1776.  
  1777.         cd first-dir
  1778.  
  1779.         if [ -f imported-file1 ] ; then
  1780.             echo "FAIL: test 114" | tee -a ${LOGFILE} ; exit 1
  1781.         else
  1782.             echo "PASS: test 114" >>${LOGFILE}
  1783.         fi
  1784.  
  1785.         for i in 2 3 ; do
  1786.             if [ -f imported-file"$i" ] ; then
  1787.                 echo "PASS: test 115-$i" >>${LOGFILE}
  1788.             else
  1789.                 echo "FAIL: test 115-$i" | tee -a ${LOGFILE} ; exit 1
  1790.             fi
  1791.         done
  1792.  
  1793.         if cat imported-file2 | grep '===='  >> ${LOGFILE}; then
  1794.             echo "PASS: test 116" >>${LOGFILE}
  1795.         else
  1796.             echo "FAIL: test 116" | tee -a ${LOGFILE} ; exit 1
  1797.         fi
  1798.         cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  1799.         rm -rf import-dir
  1800.         ;;
  1801.  
  1802.     new) # look for stray "no longer pertinent" messages.
  1803.         mkdir ${CVSROOT_DIRNAME}/first-dir
  1804.  
  1805.         if ${CVS} co first-dir  ; then
  1806.             echo "PASS: test 117" >>${LOGFILE}
  1807.         else
  1808.             echo "FAIL: test 117" | tee -a ${LOGFILE} ; exit 1
  1809.         fi
  1810.  
  1811.         cd first-dir
  1812.         touch a
  1813.  
  1814.         if ${CVS} add a  2>>${LOGFILE}; then
  1815.             echo "PASS: test 118" >>${LOGFILE}
  1816.         else
  1817.             echo "FAIL: test 118" | tee -a ${LOGFILE} ; exit 1
  1818.         fi
  1819.  
  1820.         if ${CVS} ci -m added  >>${LOGFILE} 2>&1; then
  1821.             echo "PASS: test 119" >>${LOGFILE}
  1822.         else
  1823.             echo "FAIL: test 119" | tee -a ${LOGFILE} ; exit 1
  1824.         fi
  1825.  
  1826.         rm a
  1827.  
  1828.         if ${CVS} rm a  2>>${LOGFILE}; then
  1829.             echo "PASS: test 120" >>${LOGFILE}
  1830.         else
  1831.             echo "FAIL: test 120" | tee -a ${LOGFILE} ; exit 1
  1832.         fi
  1833.  
  1834.         if ${CVS} ci -m removed >>${LOGFILE} ; then
  1835.             echo "PASS: test 121" >>${LOGFILE}
  1836.         else
  1837.             echo "FAIL: test 121" | tee -a ${LOGFILE} ; exit 1
  1838.         fi
  1839.  
  1840.         if ${CVS} update -A  2>&1 | grep longer ; then
  1841.             echo "FAIL: test 122" | tee -a ${LOGFILE} ; exit 1
  1842.         else
  1843.             echo "PASS: test 122" >>${LOGFILE}
  1844.         fi
  1845.  
  1846.         if ${CVS} update -rHEAD 2>&1 | grep longer ; then
  1847.             echo "FAIL: test 123" | tee -a ${LOGFILE} ; exit 1
  1848.         else
  1849.             echo "PASS: test 123" >>${LOGFILE}
  1850.         fi
  1851.  
  1852.         cd .. ; rm -rf first-dir ; rm -rf ${CVSROOT_DIRNAME}/first-dir
  1853.         ;;
  1854.  
  1855.     conflicts)
  1856.         rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  1857.         mkdir ${CVSROOT_DIRNAME}/first-dir
  1858.  
  1859.         mkdir 1
  1860.         cd 1
  1861.  
  1862.         if ${CVS} co first-dir ; then
  1863.             echo 'PASS: test 124' >>${LOGFILE}
  1864.         else
  1865.             echo 'FAIL: test 124' | tee -a ${LOGFILE}
  1866.         fi
  1867.  
  1868.         cd first-dir
  1869.         touch a
  1870.  
  1871.         if ${CVS} add a 2>>${LOGFILE} ; then
  1872.             echo 'PASS: test 125' >>${LOGFILE}
  1873.         else
  1874.             echo 'FAIL: test 125' | tee -a ${LOGFILE}
  1875.         fi
  1876.  
  1877.         if ${CVS} ci -m added >>${LOGFILE} 2>&1; then
  1878.             echo 'PASS: test 126' >>${LOGFILE}
  1879.         else
  1880.             echo 'FAIL: test 126' | tee -a ${LOGFILE}
  1881.         fi
  1882.  
  1883.         cd ../..
  1884.         mkdir 2
  1885.         cd 2
  1886.  
  1887.         if ${CVS} co first-dir ; then
  1888.             echo 'PASS: test 127' >>${LOGFILE}
  1889.         else
  1890.             echo 'FAIL: test 127' | tee -a ${LOGFILE}
  1891.         fi
  1892.         cd first-dir
  1893.         if test -f a; then
  1894.             echo 'PASS: test 127a' >>${LOGFILE}
  1895.         else
  1896.             echo 'FAIL: test 127a' | tee -a ${LOGFILE}
  1897.         fi
  1898.  
  1899.         cd ../../1/first-dir
  1900.         echo add a line >>a
  1901.         mkdir dir1
  1902.         dotest conflicts-127b "${testcvs} add dir1" \
  1903. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/dir1 added to the repository'
  1904.         dotest conflicts-128 "${testcvs} -q ci -m changed" \
  1905. 'Checking in a;
  1906. /tmp/cvs-sanity/cvsroot/first-dir/a,v  <--  a
  1907. new revision: 1.2; previous revision: 1.1
  1908. done'
  1909.         cd ../../2/first-dir
  1910.         echo add a conflicting line >>a
  1911.         dotest_fail conflicts-129 "${testcvs} -q ci -m changed" \
  1912. "${PROG}"' [a-z]*: Up-to-date check failed for `a'\''
  1913. '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
  1914.         mkdir dir1
  1915.         mkdir sdir
  1916.         dotest conflicts-130 "${testcvs} -q update" \
  1917. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/a,v
  1918. retrieving revision 1.1
  1919. retrieving revision 1.2
  1920. Merging differences between 1.1 and 1.2 into a
  1921. rcsmerge: warning: conflicts during merge
  1922. '"${PROG}"' [a-z]*: conflicts found in a
  1923. C a
  1924. '"${QUESTION}"' dir1
  1925. '"${QUESTION}"' sdir' \
  1926. ''"${QUESTION}"' dir1
  1927. '"${QUESTION}"' sdir
  1928. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/a,v
  1929. retrieving revision 1.1
  1930. retrieving revision 1.2
  1931. Merging differences between 1.1 and 1.2 into a
  1932. rcsmerge: warning: conflicts during merge
  1933. '"${PROG}"' [a-z]*: conflicts found in a
  1934. C a'
  1935.  
  1936.         # Try to check in the file with the conflict markers in it.
  1937.         if ${CVS} ci -m try 2>>${LOGFILE}; then
  1938.             echo 'FAIL: test 131' | tee -a ${LOGFILE}
  1939.         else
  1940.             # Should tell us to resolve conflict first
  1941.             echo 'PASS: test 131' >>${LOGFILE}
  1942.         fi
  1943.  
  1944.         echo lame attempt at resolving it >>a
  1945.         # Try to check in the file with the conflict markers in it.
  1946.         if ${CVS} ci -m try >>${LOGFILE} 2>&1; then
  1947.             echo 'FAIL: test 132' | tee -a ${LOGFILE}
  1948.         else
  1949.             # Should tell us to resolve conflict first
  1950.             echo 'PASS: test 132' >>${LOGFILE}
  1951.         fi
  1952.  
  1953.         echo resolve conflict >a
  1954.         if ${CVS} ci -m resolved >>${LOGFILE} 2>&1; then
  1955.             echo 'PASS: test 133' >>${LOGFILE}
  1956.         else
  1957.             echo 'FAIL: test 133' | tee -a ${LOGFILE}
  1958.         fi
  1959.  
  1960.         # Now test that we can add a file in one working directory
  1961.         # and have an update in another get it.
  1962.         cd ../../1/first-dir
  1963.         echo abc >abc
  1964.         if ${testcvs} add abc >>${LOGFILE} 2>&1; then
  1965.             echo 'PASS: test 134' >>${LOGFILE}
  1966.         else
  1967.             echo 'FAIL: test 134' | tee -a ${LOGFILE}
  1968.         fi
  1969.         if ${testcvs} ci -m 'add abc' abc >>${LOGFILE} 2>&1; then
  1970.             echo 'PASS: test 135' >>${LOGFILE}
  1971.         else
  1972.             echo 'FAIL: test 135' | tee -a ${LOGFILE}
  1973.         fi
  1974.         cd ../../2
  1975.         dotest conflicts-136 "${testcvs} -q update" \
  1976. '[UP] first-dir/abc
  1977. '"${QUESTION}"' first-dir/dir1
  1978. '"${QUESTION}"' first-dir/sdir' \
  1979. ''"${QUESTION}"' first-dir/dir1
  1980. '"${QUESTION}"' first-dir/sdir
  1981. [UP] first-dir/abc'
  1982.         dotest conflicts-137 'test -f first-dir/abc' ''
  1983.         rmdir first-dir/dir1 first-dir/sdir
  1984.  
  1985.         # Now test something similar, but in which the parent directory
  1986.         # (not the directory in question) has the Entries.Static flag
  1987.         # set.
  1988.         cd ../1/first-dir
  1989.         mkdir subdir
  1990.         if ${testcvs} add subdir >>${LOGFILE}; then
  1991.             echo 'PASS: test 138' >>${LOGFILE}
  1992.         else
  1993.             echo 'FAIL: test 138' | tee -a ${LOGFILE}
  1994.         fi
  1995.         cd ../..
  1996.         mkdir 3
  1997.         cd 3
  1998.         if ${testcvs} -q co first-dir/abc first-dir/subdir \
  1999.             >>${LOGFILE}; then
  2000.           echo 'PASS: test 139' >>${LOGFILE}
  2001.         else
  2002.           echo 'FAIL: test 139' | tee -a ${LOGFILE}
  2003.         fi
  2004.         cd ../1/first-dir/subdir
  2005.         echo sss >sss
  2006.         if ${testcvs} add sss >>${LOGFILE} 2>&1; then
  2007.           echo 'PASS: test 140' >>${LOGFILE}
  2008.         else
  2009.           echo 'FAIL: test 140' | tee -a ${LOGFILE}
  2010.         fi
  2011.         if ${testcvs} ci -m adding sss >>${LOGFILE} 2>&1; then
  2012.           echo 'PASS: test 140' >>${LOGFILE}
  2013.         else
  2014.           echo 'FAIL: test 140' | tee -a ${LOGFILE}
  2015.         fi
  2016.         cd ../../../3/first-dir
  2017.         if ${testcvs} -q update >>${LOGFILE}; then
  2018.           echo 'PASS: test 141' >>${LOGFILE}
  2019.         else
  2020.           echo 'FAIL: test 141' | tee -a ${LOGFILE}
  2021.         fi
  2022.         if test -f subdir/sss; then
  2023.           echo 'PASS: test 142' >>${LOGFILE}
  2024.         else
  2025.           echo 'FAIL: test 142' | tee -a ${LOGFILE}
  2026.         fi
  2027.  
  2028.         cd ../.. 
  2029.         rm -rf 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
  2030.         ;;
  2031.     modules)
  2032.       rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  2033.       mkdir ${CVSROOT_DIRNAME}/first-dir
  2034.  
  2035.       mkdir 1
  2036.       cd 1
  2037.  
  2038.       if ${testcvs} -q co first-dir; then
  2039.         echo 'PASS: test 143' >>${LOGFILE}
  2040.       else
  2041.         echo 'FAIL: test 143' | tee -a ${LOGFILE}
  2042.         exit 1
  2043.       fi
  2044.  
  2045.       cd first-dir
  2046.       mkdir subdir
  2047.       ${testcvs} add subdir >>${LOGFILE}
  2048.       cd subdir
  2049.  
  2050.       mkdir ssdir
  2051.       ${testcvs} add ssdir >>${LOGFILE}
  2052.  
  2053.       touch a b
  2054.  
  2055.       if ${testcvs} add a b 2>>${LOGFILE} ; then
  2056.         echo 'PASS: test 144' >>${LOGFILE}
  2057.       else
  2058.         echo 'FAIL: test 144' | tee -a ${LOGFILE}
  2059.         exit 1
  2060.       fi
  2061.  
  2062.       if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
  2063.         echo 'PASS: test 145' >>${LOGFILE}
  2064.       else
  2065.         echo 'FAIL: test 145' | tee -a ${LOGFILE}
  2066.         exit 1
  2067.       fi
  2068.  
  2069.       cd ..
  2070.       if ${testcvs} -q co CVSROOT >>${LOGFILE}; then
  2071.         echo 'PASS: test 146' >>${LOGFILE}
  2072.       else
  2073.         echo 'FAIL: test 146' | tee -a ${LOGFILE}
  2074.         exit 1
  2075.       fi
  2076.  
  2077.       # Here we test that CVS can deal with CVSROOT (whose repository
  2078.       # is at top level) in the same directory as subdir (whose repository
  2079.       # is a subdirectory of first-dir).  TODO: Might want to check that
  2080.       # files can actually get updated in this state.
  2081.       if ${testcvs} -q update; then
  2082.         echo 'PASS: test 147' >>${LOGFILE}
  2083.       else
  2084.         echo 'FAIL: test 147' | tee -a ${LOGFILE}
  2085.         exit 1
  2086.       fi
  2087.  
  2088.       echo realmodule first-dir/subdir a >>CVSROOT/modules
  2089.       echo dirmodule first-dir/subdir >>CVSROOT/modules
  2090.       echo namedmodule -d nameddir first-dir/subdir >>CVSROOT/modules
  2091.       echo aliasmodule -a first-dir/subdir/a >>CVSROOT/modules
  2092.       echo aliasnested -a first-dir/subdir/ssdir >>CVSROOT/modules
  2093.  
  2094.       # Options must come before arguments.  It is possible this should
  2095.       # be relaxed at some point (though the result would be bizarre for
  2096.       # -a); for now test the current behavior.
  2097.       echo bogusalias first-dir/subdir/a -a >>CVSROOT/modules
  2098.       if ${testcvs} ci -m 'add modules' CVSROOT/modules \
  2099.           >>${LOGFILE} 2>&1; then
  2100.         echo 'PASS: test 148' >>${LOGFILE}
  2101.       else
  2102.         echo 'FAIL: test 148' | tee -a ${LOGFILE}
  2103.         exit 1
  2104.       fi
  2105.       cd ..
  2106.       dotest 148a0 "${testcvs} co -c" 'CVSROOT      CVSROOT
  2107. aliasmodule  -a first-dir/subdir/a
  2108. aliasnested  -a first-dir/subdir/ssdir
  2109. bogusalias   first-dir/subdir/a -a
  2110. dirmodule    first-dir/subdir
  2111. namedmodule  -d nameddir first-dir/subdir
  2112. realmodule   first-dir/subdir a'
  2113.       # I don't know why aliasmodule isn't printed (I would have thought
  2114.       # that it gets printed without the -a; although I'm not sure that
  2115.       # printing expansions without options is useful).
  2116.       dotest 148a1 "${testcvs} co -s" 'CVSROOT      NONE        CVSROOT
  2117. bogusalias   NONE        first-dir/subdir/a -a
  2118. dirmodule    NONE        first-dir/subdir
  2119. namedmodule  NONE        first-dir/subdir
  2120. realmodule   NONE        first-dir/subdir a'
  2121.  
  2122.       # Test that real modules check out to realmodule/a, not subdir/a.
  2123.       if ${testcvs} co realmodule >>${LOGFILE}; then
  2124.         echo 'PASS: test 149a1' >>${LOGFILE}
  2125.       else
  2126.         echo 'FAIL: test 149a1' | tee -a ${LOGFILE}
  2127.         exit 1
  2128.       fi
  2129.       if test -d realmodule && test -f realmodule/a; then
  2130.         echo 'PASS: test 149a2' >>${LOGFILE}
  2131.       else
  2132.         echo 'FAIL: test 149a2' | tee -a ${LOGFILE}
  2133.         exit 1
  2134.       fi
  2135.       if test -f realmodule/b; then
  2136.         echo 'FAIL: test 149a3' | tee -a ${LOGFILE}
  2137.         exit 1
  2138.       else
  2139.         echo 'PASS: test 149a3' >>${LOGFILE}
  2140.       fi
  2141.       if ${testcvs} -q co realmodule; then
  2142.         echo 'PASS: test 149a4' >>${LOGFILE}
  2143.       else
  2144.         echo 'FAIL: test 149a4' | tee -a ${LOGFILE}
  2145.         exit 1
  2146.       fi
  2147.       if echo "yes" | ${testcvs} release -d realmodule >>${LOGFILE} ; then
  2148.         echo 'PASS: test 149a5' >>${LOGFILE}
  2149.       else
  2150.         echo 'FAIL: test 149a5' | tee -a ${LOGFILE}
  2151.         exit 1
  2152.       fi
  2153.  
  2154.       # Now test the ability to check out a single file from a directory
  2155.       if ${testcvs} co dirmodule/a >>${LOGFILE}; then
  2156.         echo 'PASS: test 150c' >>${LOGFILE}
  2157.       else
  2158.         echo 'FAIL: test 150c' | tee -a ${LOGFILE}
  2159.         exit 1
  2160.       fi
  2161.       if test -d dirmodule && test -f dirmodule/a; then
  2162.         echo 'PASS: test 150d' >>${LOGFILE}
  2163.       else
  2164.         echo 'FAIL: test 150d' | tee -a ${LOGFILE}
  2165.         exit 1
  2166.       fi
  2167.       if test -f dirmodule/b; then
  2168.         echo 'FAIL: test 150e' | tee -a ${LOGFILE}
  2169.         exit 1
  2170.       else
  2171.         echo 'PASS: test 150e' >>${LOGFILE}
  2172.       fi
  2173.       if echo "yes" | ${testcvs} release -d dirmodule >>${LOGFILE} ; then
  2174.         echo 'PASS: test 150f' >>${LOGFILE}
  2175.       else
  2176.         echo 'FAIL: test 150f' | tee -a ${LOGFILE}
  2177.         exit 1
  2178.       fi
  2179.       # Now test the ability to correctly reject a non-existent filename.
  2180.       # For maximum studliness we would check that an error message is
  2181.       # being output.
  2182.       if ${testcvs} co dirmodule/nonexist >>${LOGFILE} 2>&1; then
  2183.         # We accept a zero exit status because it is what CVS does
  2184.         # (Dec 95).  Probably the exit status should be nonzero,
  2185.         # however.
  2186.         echo 'PASS: test 150g1' >>${LOGFILE}
  2187.       else
  2188.         echo 'PASS: test 150g1' >>${LOGFILE}
  2189.       fi
  2190.       # We tolerate the creation of the dirmodule directory, since that
  2191.       # is what CVS does, not because we view that as preferable to not
  2192.       # creating it.
  2193.       if test -f dirmodule/a || test -f dirmodule/b; then
  2194.         echo 'FAIL: test 150g2' | tee -a ${LOGFILE}
  2195.         exit 1
  2196.       else
  2197.         echo 'PASS: test 150g2' >>${LOGFILE}
  2198.       fi
  2199.       rm -rf dirmodule
  2200.  
  2201.       # Now test that a module using -d checks out to the specified
  2202.       # directory.
  2203.       dotest 150h1 "${testcvs} -q co namedmodule" 'U nameddir/a
  2204. U nameddir/b'
  2205.       if test -f nameddir/a && test -f nameddir/b; then
  2206.         pass 150h2
  2207.       else
  2208.         fail 150h2
  2209.       fi
  2210.       echo add line >>nameddir/a
  2211.       dotest 150h3 "${testcvs} -q co namedmodule" 'M nameddir/a'
  2212.       rm nameddir/a
  2213.       dotest 150h4 "${testcvs} -q co namedmodule" 'U nameddir/a'
  2214.       if echo "yes" | ${testcvs} release -d nameddir >>${LOGFILE} ; then
  2215.         pass 150h99
  2216.       else
  2217.         fail 150h99
  2218.       fi
  2219.  
  2220.       # Now test that alias modules check out to subdir/a, not
  2221.       # aliasmodule/a.
  2222.       if ${testcvs} co aliasmodule >>${LOGFILE}; then
  2223.         echo 'PASS: test 151' >>${LOGFILE}
  2224.       else
  2225.         echo 'FAIL: test 151' | tee -a ${LOGFILE}
  2226.         exit 1
  2227.       fi
  2228.       if test -d aliasmodule; then
  2229.         echo 'FAIL: test 152' | tee -a ${LOGFILE}
  2230.         exit 1
  2231.       else
  2232.         echo 'PASS: test 152' >>${LOGFILE}
  2233.       fi
  2234.       echo abc >>first-dir/subdir/a
  2235.       if (${testcvs} -q co aliasmodule | tee test153.tmp) \
  2236.           >>${LOGFILE}; then
  2237.         echo 'PASS: test 153' >>${LOGFILE}
  2238.       else
  2239.         echo 'FAIL: test 153' | tee -a ${LOGFILE}
  2240.         exit 1
  2241.       fi
  2242.       echo 'M first-dir/subdir/a' >ans153.tmp
  2243.       if cmp test153.tmp ans153.tmp; then
  2244.         echo 'PASS: test 154' >>${LOGFILE}
  2245.       else
  2246.         echo 'FAIL: test 154' | tee -a ${LOGFILE}
  2247.         exit 1
  2248.       fi
  2249.  
  2250.       cd ..
  2251.       rm -rf 1
  2252.  
  2253.       mkdir 2
  2254.       cd 2
  2255.       dotest modules-155a0 "${testcvs} co aliasnested" \
  2256. "${PROG} [a-z]*: Updating first-dir/subdir/ssdir"
  2257.       dotest modules-155a1 "test -d first-dir" ''
  2258.       dotest modules-155a2 "test -d first-dir/subdir" ''
  2259.       dotest modules-155a3 "test -d first-dir/subdir/ssdir" ''
  2260.       # Test that nothing extraneous got created.
  2261.       dotest modules-155a4 "ls -1" "first-dir"
  2262.       cd ..
  2263.       rm -rf 2
  2264.  
  2265.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  2266.       ;;
  2267.     mflag)
  2268.       for message in '' ' ' '    
  2269.            ' '              test' ; do
  2270.         # Set up
  2271.         mkdir a-dir; cd a-dir
  2272.         # Test handling of -m during import
  2273.         echo testa >>test
  2274.         if ${testcvs} import -m "$message" a-dir A A1 >>${LOGFILE} 2>&1;then
  2275.           echo 'PASS: test 156' >>${LOGFILE}
  2276.         else
  2277.           echo 'FAIL: test 156' | tee -a ${LOGFILE}
  2278.           exit 1
  2279.         fi
  2280.         # Must import twice since the first time uses inline code that
  2281.         # avoids RCS call.
  2282.         echo testb >>test
  2283.         if ${testcvs} import -m "$message" a-dir A A2 >>${LOGFILE} 2>&1;then
  2284.           echo 'PASS: test 157' >>${LOGFILE}
  2285.         else
  2286.           echo 'FAIL: test 157' | tee -a ${LOGFILE}
  2287.           exit 1
  2288.         fi
  2289.         # Test handling of -m during ci
  2290.         cd ..; rm -rf a-dir;
  2291.         if ${testcvs} co a-dir >>${LOGFILE} 2>&1; then
  2292.           echo 'PASS: test 158' >>${LOGFILE}
  2293.         else
  2294.           echo 'FAIL: test 158' | tee -a ${LOGFILE}
  2295.           exit 1
  2296.         fi
  2297.         cd a-dir
  2298.         echo testc >>test
  2299.         if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
  2300.           echo 'PASS: test 159' >>${LOGFILE}
  2301.         else
  2302.           echo 'FAIL: test 159' | tee -a ${LOGFILE}
  2303.           exit 1
  2304.         fi
  2305.         # Test handling of -m during rm/ci
  2306.         rm test;
  2307.         if ${testcvs} rm test >>${LOGFILE} 2>&1; then
  2308.           echo 'PASS: test 160' >>${LOGFILE}
  2309.         else
  2310.           echo 'FAIL: test 160' | tee -a ${LOGFILE}
  2311.           exit 1
  2312.         fi
  2313.         if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
  2314.           echo 'PASS: test 161' >>${LOGFILE}
  2315.         else
  2316.           echo 'FAIL: test 161' | tee -a ${LOGFILE}
  2317.           exit 1
  2318.         fi
  2319.         # Clean up
  2320.         cd ..; rm -rf a-dir ${CVSROOT_DIRNAME}/a-dir
  2321.       done
  2322.       ;;
  2323.     errmsg1)
  2324.       mkdir ${CVSROOT_DIRNAME}/1dir
  2325.       mkdir 1
  2326.       cd 1
  2327.       if ${testcvs} -q co 1dir; then
  2328.         echo 'PASS: test 162' >>${LOGFILE}
  2329.       else
  2330.         echo 'FAIL: test 162' | tee -a ${LOGFILE}
  2331.         exit 1
  2332.       fi
  2333.       cd 1dir
  2334.       touch foo
  2335.       if ${testcvs} add foo 2>>${LOGFILE}; then
  2336.         echo 'PASS: test 163' >>${LOGFILE}
  2337.       else
  2338.         echo 'FAIL: test 163' | tee -a ${LOGFILE}
  2339.         exit 1
  2340.       fi
  2341.       if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
  2342.         echo 'PASS: test 164' >>${LOGFILE}
  2343.       else
  2344.         echo 'FAIL: test 164' | tee -a ${LOGFILE}
  2345.         exit 1
  2346.       fi
  2347.       cd ../..
  2348.       mkdir 2
  2349.       cd 2
  2350.       if ${testcvs} -q co 1dir >>${LOGFILE}; then
  2351.         echo 'PASS: test 165' >>${LOGFILE}
  2352.       else
  2353.         echo 'FAIL: test 165' | tee -a ${LOGFILE}
  2354.         exit 1
  2355.       fi
  2356.       chmod a-w 1dir
  2357.       cd ../1/1dir
  2358.       rm foo; 
  2359.       if ${testcvs} rm foo >>${LOGFILE} 2>&1; then
  2360.         echo 'PASS: test 166' >>${LOGFILE}
  2361.       else
  2362.         echo 'FAIL: test 166' | tee -a ${LOGFILE}
  2363.         exit 1
  2364.       fi
  2365.       if ${testcvs} ci -m removed >>${LOGFILE} 2>&1; then
  2366.         echo 'PASS: test 167' >>${LOGFILE}
  2367.       else
  2368.         echo 'FAIL: test 167' | tee -a ${LOGFILE}
  2369.         exit 1
  2370.       fi
  2371.  
  2372.       cd ../../2/1dir
  2373.       # FIXME: should be using dotest and PROG.
  2374.       ${testcvs} -q update 2>../tst167.err
  2375.       CVSBASE=`basename $testcvs`    # Get basename of CVS executable.
  2376.       cat <<EOF >../tst167.ans
  2377. $CVSBASE server: warning: foo is not (any longer) pertinent
  2378. $CVSBASE update: unable to remove ./foo: Permission denied
  2379. EOF
  2380.       if cmp ../tst167.ans ../tst167.err >/dev/null ||
  2381.       ( echo "$CVSBASE [update aborted]: cannot rename file foo to CVS/,,foo: Permission denied" | cmp - ../tst167.err >/dev/null )
  2382.       then
  2383.         echo 'PASS: test 168' >>${LOGFILE}
  2384.       else
  2385.         echo 'FAIL: test 168' | tee -a ${LOGFILE}
  2386.         exit 1
  2387.       fi
  2388.  
  2389.       cd ..
  2390.       chmod u+w 1dir
  2391.       cd ..
  2392.       rm -rf 1 2 ${CVSROOT_DIRNAME}/1dir
  2393.       ;;
  2394.  
  2395.     devcom)
  2396.       mkdir ${CVSROOT_DIRNAME}/first-dir
  2397.       mkdir 1
  2398.       cd 1
  2399.       if ${testcvs} -q co first-dir >>${LOGFILE} ; then
  2400.         echo 'PASS: test 169' >>${LOGFILE}
  2401.       else
  2402.         echo 'FAIL: test 169' | tee -a ${LOGFILE}
  2403.         exit 1
  2404.       fi
  2405.  
  2406.       cd first-dir
  2407.       echo abb >abb
  2408.       if ${testcvs} add abb 2>>${LOGFILE}; then
  2409.         echo 'PASS: test 170' >>${LOGFILE}
  2410.       else
  2411.         echo 'FAIL: test 170' | tee -a ${LOGFILE}
  2412.         exit 1
  2413.       fi
  2414.       if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
  2415.         echo 'PASS: test 171' >>${LOGFILE}
  2416.       else
  2417.         echo 'FAIL: test 171' | tee -a ${LOGFILE}
  2418.         exit 1
  2419.       fi
  2420.       dotest_fail 171a0 "${testcvs} watch" "Usage${DOTSTAR}"
  2421.       if ${testcvs} watch on; then
  2422.         echo 'PASS: test 172' >>${LOGFILE}
  2423.       else
  2424.         echo 'FAIL: test 172' | tee -a ${LOGFILE}
  2425.       fi
  2426.       echo abc >abc
  2427.       if ${testcvs} add abc 2>>${LOGFILE}; then
  2428.         echo 'PASS: test 173' >>${LOGFILE}
  2429.       else
  2430.         echo 'FAIL: test 173' | tee -a ${LOGFILE}
  2431.       fi
  2432.       if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
  2433.         echo 'PASS: test 174' >>${LOGFILE}
  2434.       else
  2435.         echo 'FAIL: test 174' | tee -a ${LOGFILE}
  2436.       fi
  2437.  
  2438.       cd ../..
  2439.       mkdir 2
  2440.       cd 2
  2441.  
  2442.       if ${testcvs} -q co first-dir >>${LOGFILE}; then
  2443.         echo 'PASS: test 175' >>${LOGFILE}
  2444.       else
  2445.         echo 'FAIL: test 175' | tee -a ${LOGFILE}
  2446.       fi
  2447.       cd first-dir
  2448.       if test -w abb; then
  2449.         echo 'FAIL: test 176' | tee -a ${LOGFILE}
  2450.       else
  2451.         echo 'PASS: test 176' >>${LOGFILE}
  2452.       fi
  2453.       if test -w abc; then
  2454.         echo 'FAIL: test 177' | tee -a ${LOGFILE}
  2455.       else
  2456.         echo 'PASS: test 177' >>${LOGFILE}
  2457.       fi
  2458.  
  2459.       if ${testcvs} editors >../ans178.tmp; then
  2460.         echo 'PASS: test 178' >>${LOGFILE}
  2461.       else
  2462.         echo 'FAIL: test 178' | tee -a ${LOGFILE}
  2463.       fi
  2464.       cat ../ans178.tmp >>${LOGFILE}
  2465.       if test -s ../ans178.tmp; then
  2466.         echo 'FAIL: test 178a' | tee -a ${LOGFILE}
  2467.       else
  2468.         echo 'PASS: test 178a' >>${LOGFILE}
  2469.       fi
  2470.  
  2471.       if ${testcvs} edit abb; then
  2472.         echo 'PASS: test 179' >>${LOGFILE}
  2473.       else
  2474.         echo 'FAIL: test 179' | tee -a ${LOGFILE}
  2475.         exit 1
  2476.       fi
  2477.  
  2478.       if ${testcvs} editors >../ans180.tmp; then
  2479.         echo 'PASS: test 180' >>${LOGFILE}
  2480.       else
  2481.         echo 'FAIL: test 180' | tee -a ${LOGFILE}
  2482.         exit 1
  2483.       fi
  2484.       cat ../ans180.tmp >>${LOGFILE}
  2485.       if test -s ../ans180.tmp; then
  2486.         echo 'PASS: test 181' >>${LOGFILE}
  2487.       else
  2488.         echo 'FAIL: test 181' | tee -a ${LOGFILE}
  2489.       fi
  2490.  
  2491.       echo aaaa >>abb
  2492.       if ${testcvs} ci -m modify abb >>${LOGFILE} 2>&1; then
  2493.         echo 'PASS: test 182' >>${LOGFILE}
  2494.       else
  2495.         echo 'FAIL: test 182' | tee -a ${LOGFILE}
  2496.       fi
  2497.       # Unedit of a file not being edited should be a noop.
  2498.       dotest 182.5 "${testcvs} unedit abb" ''
  2499.  
  2500.       if ${testcvs} editors >../ans183.tmp; then
  2501.         echo 'PASS: test 183' >>${LOGFILE}
  2502.       else
  2503.         echo 'FAIL: test 183' | tee -a ${LOGFILE}
  2504.       fi
  2505.       cat ../ans183.tmp >>${LOGFILE}
  2506.       if test -s ../ans183.tmp; then
  2507.         echo 'FAIL: test 184' | tee -a ${LOGFILE}
  2508.       else
  2509.         echo 'PASS: test 184' >>${LOGFILE}
  2510.       fi
  2511.  
  2512.       if test -w abb; then
  2513.         echo 'FAIL: test 185' | tee -a ${LOGFILE}
  2514.       else
  2515.         echo 'PASS: test 185' >>${LOGFILE}
  2516.       fi
  2517.  
  2518.       if ${testcvs} edit abc; then
  2519.         echo 'PASS: test 186a1' >>${LOGFILE}
  2520.       else
  2521.         echo 'FAIL: test 186a1' | tee -a ${LOGFILE}
  2522.       fi
  2523.       # Unedit of an unmodified file.
  2524.       if ${testcvs} unedit abc; then
  2525.         echo 'PASS: test 186a2' >>${LOGFILE}
  2526.       else
  2527.         echo 'FAIL: test 186a2' | tee -a ${LOGFILE}
  2528.       fi
  2529.       if ${testcvs} edit abc; then
  2530.         echo 'PASS: test 186a3' >>${LOGFILE}
  2531.       else
  2532.         echo 'FAIL: test 186a3' | tee -a ${LOGFILE}
  2533.       fi
  2534.       echo changedabc >abc
  2535.       # Try to unedit a modified file; cvs should ask for confirmation
  2536.       if (echo no | ${testcvs} unedit abc) >>${LOGFILE}; then
  2537.         echo 'PASS: test 186a4' >>${LOGFILE}
  2538.       else
  2539.         echo 'FAIL: test 186a4' | tee -a ${LOGFILE}
  2540.       fi
  2541.       if echo changedabc | cmp - abc; then
  2542.         echo 'PASS: test 186a5' >>${LOGFILE}
  2543.       else
  2544.         echo 'FAIL: test 186a5' | tee -a ${LOGFILE}
  2545.       fi
  2546.       # OK, now confirm the unedit
  2547.       if (echo yes | ${testcvs} unedit abc) >>${LOGFILE}; then
  2548.         echo 'PASS: test 186a6' >>${LOGFILE}
  2549.       else
  2550.         echo 'FAIL: test 186a6' | tee -a ${LOGFILE}
  2551.       fi
  2552.       if echo abc | cmp - abc; then
  2553.         echo 'PASS: test 186a7' >>${LOGFILE}
  2554.       else
  2555.         echo 'FAIL: test 186a7' | tee -a ${LOGFILE}
  2556.       fi
  2557.  
  2558.       dotest devcom-a0 "${testcvs} watchers" ''
  2559.       dotest devcom-a1 "${testcvs} watch add" ''
  2560.       dotest devcom-a2 "${testcvs} watchers" \
  2561. 'abb    [a-z0-9]*    edit    unedit    commit
  2562. abc    [a-z0-9]*    edit    unedit    commit'
  2563.       dotest devcom-a3 "${testcvs} watch remove -a unedit abb" ''
  2564.       dotest devcom-a4 "${testcvs} watchers abb" \
  2565. 'abb    [a-z0-9]*    edit    commit'
  2566.  
  2567.       cd ../..
  2568.       rm -rf 1 2 ${CVSROOT_DIRNAME}/first-dir
  2569.       ;;
  2570.  
  2571.     ignore)
  2572.       dotest 187a1 "${testcvs} -q co CVSROOT" 'U CVSROOT/modules'
  2573.       cd CVSROOT
  2574.       echo rootig.c >cvsignore
  2575.       dotest 187a2 "${testcvs} add cvsignore" "${PROG}"' [a-z]*: scheduling file `cvsignore'"'"' for addition
  2576. '"${PROG}"' [a-z]*: use '"'"'cvs commit'"'"' to add this file permanently'
  2577.  
  2578.       # As of Jan 96, local CVS prints "Examining ." and remote doesn't.
  2579.       # Accept either.
  2580.       dotest 187a3 " ${testcvs} ci -m added" \
  2581. "${DOTSTAR}"'CS file: /tmp/cvs-sanity/cvsroot/CVSROOT/cvsignore,v
  2582. done
  2583. Checking in cvsignore;
  2584. /tmp/cvs-sanity/cvsroot/CVSROOT/cvsignore,v  <--  cvsignore
  2585. initial revision: 1.1
  2586. done
  2587. '"${PROG}"' [a-z]*: Rebuilding administrative file database'
  2588.  
  2589.       cd ..
  2590.       if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
  2591.         echo 'PASS: test 187a4' >>${LOGFILE}
  2592.       else
  2593.         echo 'FAIL: test 187a4' | tee -a ${LOGFILE}
  2594.         exit 1
  2595.       fi
  2596.  
  2597.       # CVS looks at the home dir from getpwuid, not HOME (is that correct
  2598.       # behavior?), so this is hard to test and we won't try.
  2599.       # echo foobar.c >${HOME}/.cvsignore
  2600.       CVSIGNORE=envig.c; export CVSIGNORE
  2601.       mkdir dir-to-import
  2602.       cd dir-to-import
  2603.       touch foobar.c bar.c rootig.c defig.o envig.c optig.c
  2604.       # We really should allow the files to be listed in any order.
  2605.       # But we (kludgily) just list the orders which have been observed.
  2606.       dotest 188a "${testcvs} import -m m -I optig.c first-dir tag1 tag2" \
  2607.         'N first-dir/foobar.c
  2608. N first-dir/bar.c
  2609. I first-dir/rootig.c
  2610. I first-dir/defig.o
  2611. I first-dir/envig.c
  2612. I first-dir/optig.c
  2613.  
  2614. No conflicts created by this import' 'I first-dir/defig.o
  2615. I first-dir/envig.c
  2616. I first-dir/optig.c
  2617. N first-dir/foobar.c
  2618. N first-dir/bar.c
  2619. I first-dir/rootig.c
  2620.  
  2621. No conflicts created by this import'
  2622.       dotest 188b "${testcvs} import -m m -I ! second-dir tag3 tag4" \
  2623.         'N second-dir/foobar.c
  2624. N second-dir/bar.c
  2625. N second-dir/rootig.c
  2626. N second-dir/defig.o
  2627. N second-dir/envig.c
  2628. N second-dir/optig.c
  2629.  
  2630. No conflicts created by this import'
  2631.       cd ..
  2632.       rm -rf dir-to-import
  2633.  
  2634.       dotest 189a "${testcvs} -q co second-dir" \
  2635. 'U second-dir/bar.c
  2636. U second-dir/defig.o
  2637. U second-dir/envig.c
  2638. U second-dir/foobar.c
  2639. U second-dir/optig.c
  2640. U second-dir/rootig.c'
  2641.       rm -rf second-dir
  2642.       dotest 189b "${testcvs} -q co first-dir" 'U first-dir/bar.c
  2643. U first-dir/foobar.c'
  2644.       cd first-dir
  2645.       touch rootig.c defig.o envig.c optig.c notig.c
  2646.       dotest 189c "${testcvs} -q update -I optig.c" "${QUESTION} notig.c"
  2647.       # The fact that CVS requires us to specify -I CVS here strikes me
  2648.       # as a bug.
  2649.       dotest 189d "${testcvs} -q update -I ! -I CVS" "${QUESTION} rootig.c
  2650. ${QUESTION} defig.o
  2651. ${QUESTION} envig.c
  2652. ${QUESTION} optig.c
  2653. ${QUESTION} notig.c"
  2654.       cd ..
  2655.       rm -rf first-dir
  2656.  
  2657.       rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
  2658.       ;;
  2659.  
  2660.     binfiles)
  2661.       # Test cvs's ability to handle binary files.
  2662.       mkdir ${CVSROOT_DIRNAME}/first-dir
  2663.       mkdir 1; cd 1
  2664.       dotest binfiles-1 "${testcvs} -q co first-dir" ''
  2665.       awk 'BEGIN { printf "%c%c%c%c%c%c", 2, 10, 137, 0, 13, 10 }' \
  2666.         </dev/null >binfile.dat
  2667.       cat binfile.dat binfile.dat >binfile2.dat
  2668.       cd first-dir
  2669.       cp ../binfile.dat binfile
  2670.       dotest binfiles-2 "${testcvs} add -kb binfile" \
  2671. "${PROG}"' [a-z]*: scheduling file `binfile'\'' for addition
  2672. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  2673.       dotest binfiles-3 "${testcvs} -q ci -m add-it" \
  2674. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  2675. done
  2676. Checking in binfile;
  2677. /tmp/cvs-sanity/cvsroot/first-dir/binfile,v  <--  binfile
  2678. initial revision: 1.1
  2679. done'
  2680.       cd ../..
  2681.       mkdir 2; cd 2
  2682.       dotest binfiles-4 "${testcvs} -q co first-dir" 'U first-dir/binfile'
  2683.       cd first-dir
  2684.       dotest binfiles-5 "cmp ../../1/binfile.dat binfile" ''
  2685.       # Testing that sticky options is -kb is the closest thing we have
  2686.       # to testing that binary files work right on non-unix machines
  2687.       # (until there is automated testing for such machines, of course).
  2688.       dotest binfiles-5.5 "${testcvs} status binfile" \
  2689. '===================================================================
  2690. File: binfile              Status: Up-to-date
  2691.  
  2692.    Working revision:    1\.1.*
  2693.    Repository revision:    1\.1    /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  2694.    Sticky Tag:        (none)
  2695.    Sticky Date:        (none)
  2696.    Sticky Options:    -kb'
  2697.       cp ../../1/binfile2.dat binfile
  2698.       dotest binfiles-6 "${testcvs} -q ci -m modify-it" \
  2699. 'Checking in binfile;
  2700. /tmp/cvs-sanity/cvsroot/first-dir/binfile,v  <--  binfile
  2701. new revision: 1.2; previous revision: 1.1
  2702. done'
  2703.       cd ../../1/first-dir
  2704.       dotest binfiles-7 "${testcvs} -q update" '[UP] binfile'
  2705.       dotest binfiles-8 "cmp ../binfile2.dat binfile" ''
  2706.  
  2707.       # The bugs which these test for are apparently not fixed for remote.
  2708.       if test "$remote" = no; then
  2709.         dotest binfiles-9 "${testcvs} -q update -A" ''
  2710.         dotest binfiles-10 "${testcvs} -q update -kk" '[UP] binfile'
  2711.         dotest binfiles-11 "${testcvs} -q update" ''
  2712.         dotest binfiles-12 "${testcvs} -q update -A" '[UP] binfile'
  2713.         dotest binfiles-13 "${testcvs} -q update -A" ''
  2714.       fi
  2715.  
  2716.       cd ../../2/first-dir
  2717.       echo 'this file is $''RCSfile$' >binfile
  2718.       dotest binfiles-14a "${testcvs} -q ci -m modify-it" \
  2719. 'Checking in binfile;
  2720. /tmp/cvs-sanity/cvsroot/first-dir/binfile,v  <--  binfile
  2721. new revision: 1.3; previous revision: 1.2
  2722. done'
  2723.       dotest binfiles-14b "cat binfile" 'this file is $''RCSfile$'
  2724.       # See binfiles-5.5 for discussion of -kb.
  2725.       dotest binfiles-14c "${testcvs} status binfile" \
  2726. '===================================================================
  2727. File: binfile              Status: Up-to-date
  2728.  
  2729.    Working revision:    1\.3.*
  2730.    Repository revision:    1\.3    /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  2731.    Sticky Tag:        (none)
  2732.    Sticky Date:        (none)
  2733.    Sticky Options:    -kb'
  2734.       dotest binfiles-14d "${testcvs} admin -kv binfile" \
  2735. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  2736. done'
  2737.       # cvs admin doesn't change the checked-out file or its sticky
  2738.       # kopts.  There probably should be a way which does (but
  2739.       # what if the file is modified?  And do we try to version
  2740.       # control the kopt setting?)
  2741.       dotest binfiles-14e "cat binfile" 'this file is $''RCSfile$'
  2742.       dotest binfiles-14f "${testcvs} status binfile" \
  2743. '===================================================================
  2744. File: binfile              Status: Up-to-date
  2745.  
  2746.    Working revision:    1\.3.*
  2747.    Repository revision:    1\.3    /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  2748.    Sticky Tag:        (none)
  2749.    Sticky Date:        (none)
  2750.    Sticky Options:    -kb'
  2751.       dotest binfiles-14g "${testcvs} -q update -A" '[UP] binfile'
  2752.       dotest binfiles-14h "cat binfile" 'this file is binfile,v'
  2753.       dotest binfiles-14i "${testcvs} status binfile" \
  2754. '===================================================================
  2755. File: binfile              Status: Up-to-date
  2756.  
  2757.    Working revision:    1\.3.*
  2758.    Repository revision:    1\.3    /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  2759.    Sticky Tag:        (none)
  2760.    Sticky Date:        (none)
  2761.    Sticky Options:    -kv'
  2762.  
  2763.       cd ../..
  2764.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  2765.       rm -r 1 2
  2766.       ;;
  2767.     info)
  2768.       # Test CVS's ability to handle *info files.
  2769.       dotest info-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
  2770.       cd CVSROOT
  2771.       echo "ALL sh -c \"echo x\${=MYENV}\${=OTHER}y\${=ZEE}=\$USER=\$CVSROOT= >>$TESTDIR/testlog; cat >/dev/null\"" > loginfo
  2772.       dotest info-2 "${testcvs} add loginfo" \
  2773. "${PROG}"' [a-z]*: scheduling file `loginfo'"'"' for addition
  2774. '"${PROG}"' [a-z]*: use '"'"'cvs commit'"'"' to add this file permanently'
  2775.       dotest info-3 "${testcvs} -q ci -m new-loginfo" \
  2776. 'RCS file: /tmp/cvs-sanity/cvsroot/CVSROOT/loginfo,v
  2777. done
  2778. Checking in loginfo;
  2779. /tmp/cvs-sanity/cvsroot/CVSROOT/loginfo,v  <--  loginfo
  2780. initial revision: 1.1
  2781. done
  2782. '"${PROG}"' [a-z]*: Rebuilding administrative file database'
  2783.       cd ..
  2784.       if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
  2785.         pass info-4
  2786.       else
  2787.         fail info-4
  2788.       fi
  2789.  
  2790.       mkdir ${CVSROOT_DIRNAME}/first-dir
  2791.       dotest info-5 "${testcvs} -q co first-dir" ''
  2792.       cd first-dir
  2793.       touch file1
  2794.       dotest info-6 "${testcvs} add file1" \
  2795. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
  2796. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  2797.       echo "cvs -s OTHER=not-this -s MYENV=env-" >>$HOME/.cvsrc
  2798.       dotest info-6a "${testcvs} -q -s OTHER=value ci -m add-it" \
  2799. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  2800. done
  2801. Checking in file1;
  2802. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  2803. initial revision: 1.1
  2804. done
  2805. '"${PROG}"' [a-z]*: loginfo:1: no such user variable ${=ZEE}'
  2806.       echo line1 >>file1
  2807.       dotest info-7 "${testcvs} -q -s OTHER=value -s ZEE=z ci -m mod-it" \
  2808. 'Checking in file1;
  2809. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  2810. new revision: 1.2; previous revision: 1.1
  2811. done'
  2812.       cd ..
  2813.       if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE} ; then
  2814.         pass info-8
  2815.       else
  2816.         fail info-8
  2817.       fi
  2818.       dotest info-9 "cat $TESTDIR/testlog" 'xenv-valueyz=[a-z@][a-z@]*=/tmp/cvs-sanity/cvsroot='
  2819.  
  2820.       # I think this might be doable with cvs remove, or at least
  2821.       # checking in a version with only comments, but I'm too lazy
  2822.       # at the moment.  Blow it away.
  2823.       rm -f ${CVSROOT_DIRNAME}/CVSROOT/loginfo*
  2824.  
  2825.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  2826.       ;;
  2827.     *)
  2828.        echo $what is not the name of a test -- ignored
  2829.        ;;
  2830.     esac
  2831. done
  2832.  
  2833. echo "OK, all tests completed."
  2834.  
  2835. # TODO:
  2836. # * Test `cvs admin'.
  2837. # * Test `cvs update -d foo' (where foo does not exist).
  2838. # * Test `cvs update foo bar' (where foo and bar are both from the same
  2839. #   repository).  Suppose one is a branch--make sure that both directories
  2840. #   get updated with the respective correct thing.
  2841. # * `cvs update ../foo'.  Also ../../foo ./../foo foo/../../bar /foo/bar
  2842. #   foo/.././../bar foo/../bar etc.
  2843. # * Test all flags in modules file.
  2844. #   Test that ciprog gets run both on checkin in that directory, or a
  2845. #     higher-level checkin which recurses into it.
  2846. # * Test that $ followed by "Header" followed by $ gets expanded on checkin.
  2847. # * Test operations on a directory that contains other directories but has 
  2848. #   no files of its own.
  2849. # * -t global option
  2850. # * cvs rm followed by cvs add or vice versa (with no checkin in between).
  2851. # * cvs rm twice (should be a nice error message).
  2852. # * -P option to checkout--(a) refrains from checking out new empty dirs,
  2853. #   (b) prunes empty dirs already there.
  2854. # * Test that cvs -d `hostname`:/tmp/cvs-sanity/non/existent co foo
  2855. #   gives an appropriate error (e.g. 
  2856. #     Cannot access /tmp/cvs-sanity/non-existent/CVSROOT
  2857. #     No such file or directory).
  2858. # * Test ability to send notifications in response to watches.  (currently
  2859. #   hard to test because CVS doesn't send notifications if username is the
  2860. #   same).
  2861. # * Test that remote edit and/or unedit works when disconnected from
  2862. #   server (e.g. set CVS_SERVER to "foobar").
  2863. # End of TODO list.
  2864.  
  2865. # Remove the test directory, but first change out of it.
  2866. cd /tmp
  2867. rm -rf ${TESTDIR}
  2868.  
  2869. # end of sanity.sh
  2870.